On May 8, 2006, at 8:27 AM, Jay Wooten wrote:
We are updating the printing capabilities of our app. Up to now,
all the reports it generated were left justified, simple reports.
Now our users want alignment, font and text size capabilities.
So we started looking at the StyledTextPrinter and DrawBlock
methods and found that the DrawBlock doesn't support alignment (???)
Is that true? If not, then how the heck do you center, right align
text?
So then we thought about doing something with DrawString of a
graphics object - which we have working and have been using.
However we run into an issue when we have a long string of text
(i.e. needs to wrap) that we want centered, and it appears at the
bottom of a printed page, where some of the text is one page 1, and
the remainder would be on page two.
The g.drawstring(s, x, y, wrapwidth) is simple enough, but how do
split the text into multiple lines so you can move the lines onto
the next page if necessary.
It's early and I haven't had my coffee yet, so I am probably
overlooking the obvious.
It's not obvious. I've sunk a lot of time into writing classes to do
printing. Page-breaking is especially tricky. What I've done is to
write a DocumentRenderer class, plus several supporting classes, to
handle text layout. Eventually it may all become an RBD article when
I can find some time.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>