P
pgweber
I'm writing an application that prints out several lines of text. Each
line consists of a label, followed by some dots (for formatting), and
then a number... simple enough.
Here's an example of the formatted output:
Some unknown-length descriptive label ......... 25.00
Another descriptive label ..................... 5.6
A third label of unknown length ............... 185.15
I know the right edge is ragged in the example above, and that's just
the problem. My customer wants the output to be sent to a Word
document, and the program works with several languages: English,
German, Portuguese, French, Spanish, even Japanese, so I don't know how
wide the labels will be.
If I could determine the maximum available width of a line, then the
width of the text string, it seems I could add dots until the
formatting is correct. I'm thinking a tab would also work for the
number column, but I'd still have a problem with the dots, which do
need to remain.
line consists of a label, followed by some dots (for formatting), and
then a number... simple enough.
Here's an example of the formatted output:
Some unknown-length descriptive label ......... 25.00
Another descriptive label ..................... 5.6
A third label of unknown length ............... 185.15
I know the right edge is ragged in the example above, and that's just
the problem. My customer wants the output to be sent to a Word
document, and the program works with several languages: English,
German, Portuguese, French, Spanish, even Japanese, so I don't know how
wide the labels will be.
If I could determine the maximum available width of a line, then the
width of the text string, it seems I could add dots until the
formatting is correct. I'm thinking a tab would also work for the
number column, but I'd still have a problem with the dots, which do
need to remain.