Hello Bob,
Quote:This part of your code is not going to work. The @Len is going to return the number of characters in "first" not the amount of space it took "first" to print. @Len on the word "John Jacob" will return 10 but the actual space it takes to print out is more like 63 (Arial font size 12 on NewPage(850, 1100)). A value of -1 will cause the number to print right after the name.
Quote:Can you please explain the logic behind the original (20 - Len(Key)*2)?
The 20 is just a number that I picked to give me the spacing that I wanted. One way to right align values in printstring is to pad them over to the right with spaces. In the arial font a Number takes up the same amount of space as two space characters. That is why there is a times 2 at the end. You could use a 10 instead of a 20 if you wanted the numbers closer to the name. You should always use a number that is bigger than the number of characters in your biggest number including commas, periods and other symbols.
Quote: How to calculate the column width?
You can use @PageExtentX() after you print your column to see the width of it.
Quote: Any clues on how to calculate that qty number for "."
You would have to use a fixed width font for the name instead of using arial. The code would be something like this
PrintString(First , vX, vY, 0, "Courier New", 16, 0)
PrintString(@Text((30 - @Len(Key) - @Len(First)), ".") + Key , -1, vY, 0, "Courier New", 16, 0)
-Ray