Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print alignment question
Message
From
30/04/2014 08:34:59
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01599257
Message ID:
01599289
Views:
54
>I have a customer that just made a request that tickled me a little bit, but
>a customer is always right, lol. She wants the verbage that is printed on
>a report to start each line at the same position. That's no problem at all
>obviously. But she wants the right side to end on the same position too.
>
>If there is anyway to do this, I would appreciate the help. I'm hoping its
>as easy as changing the font I'm using. I know Courier New would
>probably do it if every line had the exact same number of characters, but
>that is not the case.
>

This is one of those things I remember having an exercise in a programming class a million years ago. With a fixed-width font, you can write the code to justify. The algorithm is something like:

- determine # of chars you want per line
- break your string up into substrings of no more than that width, that is, lines
- for each line, find the word breaks and add spaces to them until the line is exactly the right width

The third step is the challenging one because you want to distribute the extra blanks in a way that's pleasing to the eye.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform