Using Format Function to Right Justify

When using printer.print statements to send output directly to the printer, it used to be possible in QB PDS to use something like “printer.print format(number, “###,###.00”) to get right justification of numbers on successive lines. Now, although the MS documentation says that the “#” characters act as placeholders, they actually do not. How can you format numbers so that they right-justify on a printout?

If you know how long your field is (maximum length), you can simply subtract the length of your formatted number from it. You then add that many spaces to the front of the number. That will force the string to the right.

On 3/31/00, Marty Liss responded:
This is incorrect. It is true only if you are using a fixed-width font like Courier, otherwise the leading spaces are thinner than the numbers so the justification that results from this tip is ragged.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: