Printing text using specific justification or word-wrap

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Printing text using specific justification or word-wrap

Postby lancelot59 » June 24th, 2005, 11:40 am

Hi Kambiz

Just stumbled on your TPrintPreview... Impressive !

I wonder if you can help me with the following:
I need to print an unknown amount of text, wordwrapped inside a cell (sort of like in Excel), or even filled, or otherwise justified.
Currenly I manually perform these tasks, and it works, but I wonder if there are better ways to do this:
Maybe mis-use the TRichedit for that purpose,
maybe even there is a windows way to just inform windows that text is to be printed in a word-wrap way, or using a certain justification, to a certain rectangular area...

Since you obviously are very aware of all print-possibilities, please give me your advise on how to handle this.

Thanks.

Ron Gommers
ron@itsoftware.nl
User avatar
lancelot59
Member
Member
 
Posts: 4
Joined: June 21st, 2005, 11:31 am
Location: The Netherlands

Postby Kambiz » June 24th, 2005, 4:40 pm

The rich edit contorl comes with Delphi is too poor. Try to use a third party rich edit control. I personally use RxRichEdit that comes with RxLib, but I know there are even better rich edit controls on the net for free.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby lancelot59 » June 25th, 2005, 5:01 pm

Ok, so you use RxRichEdit.
But what I wanted to know if there is another way to force text to be printed "wrapped" to a certain rectangle. Image printing a few thousand cell's from a spreadsheet, and having to go to a RichEdit to be able to format every separate cell.

A few other questions:
1. Word as well as rtf can use fontsize 7.5, how would I be able to do the same ?
2. Would it be possible to have a configurable resolution, currently fixed to screen.pixelsperinch. So when creating pages for display, they could be created assuming 300dpi or 600dpi or whatever, just to be able to really zoom into what is going to be printed.

Thanks...

Ron.
User avatar
lancelot59
Member
Member
 
Posts: 4
Joined: June 21st, 2005, 11:31 am
Location: The Netherlands

Postby lancelot59 » June 25th, 2005, 5:02 pm

sorry, "Image printing..." should be "Imagine printing..."
User avatar
lancelot59
Member
Member
 
Posts: 4
Joined: June 21st, 2005, 11:31 am
Location: The Netherlands

Postby Kambiz » June 27th, 2005, 10:37 am

Hi,

By using PaintRichText method of PrintPreview, you can print a rich text in any rectangle.

For setting the font size as a real number you can use the following code:
Code: Select all
Font.Height := -Round(SizeOfFont * Screen.PixelsPerInch / 72);

Using a higher than actual screen resolution makes the result larger than the actual size. The current code gererates the correct result.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Bing [Bot] and 1 guest