First Line Spacing in a paragraph!

General TRichView support forum. Please post your questions here
Post Reply
Zala
Posts: 12
Joined: Mon Jun 09, 2008 8:02 pm

First Line Spacing in a paragraph!

Post by Zala »

Hi,

I'm currently using the TRichView Wrapper with Report Builder. Before, my company was using a componant (TrxCustomRichEdit) that can use LineSpacing instead of the standard RichText of Report Builder.

My problem is that TrxCustomRichEdit was able to set LineSpacing before the paragraph in Percent. The only way that I have found to do the same thing in TRichView is the property SpaceBefore. The fact is that it can only be use in pixel of screen but I need it in Percent.

Do you know a way to solve my problem?

Michel
Zala
Posts: 12
Joined: Mon Jun 09, 2008 8:02 pm

Dots per inch (DPI)

Post by Zala »

Also, I would like to know if there is a way to use Dots per inch (DPI) instead of Pixel to set the LineSpacing.

Michel
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

There are 3 vertical spacing properties for the paragraph:
SpaceBefore - spacing before the paragraph,
SpaceAfter - spacing after the paragraph,
LineSpacing - spacing between lines of the paragraph, added AFTER each line.
None of known word processors can define SpaceBefore or SpaceAfter in Percent.
As far as I can see from RX code, RXRichEdit defines them in points (1/72 of inch), not in Percent.
Only LineSpacing can be defined in Percent. But it is defined in Percent by default in TRichViewEdit too (see LineSpacing property), so there is no problem here.

As for defining sizes in absolute values instead of pixels, it is not possible directly, but you can set up a conversion independent from the screen resolution.
Assign RichViewPixelsPerInch=96, and you will be able to convert using the following functions:

Code: Select all

function InchesToPixels(Value: Extended): Integer;
begin
  Result := Round(Value * 96);
end;

function PixelsToInches(Value: Integer): Extended;
begin
  Result := Value / 96;
end;
Zala
Posts: 12
Joined: Mon Jun 09, 2008 8:02 pm

That was quick!

Post by Zala »

Thank you for the quick answer, I'll try to solve my problem with the tools you have provided me!

Michel
Zala
Posts: 12
Joined: Mon Jun 09, 2008 8:02 pm

Post by Zala »

Hello,

I am trying to understand why, when I have two document with exactly the same rtf code, and when I am printing them with Trx component and with TRichView component, my LineSpacing are not exactly the same?

Thanks for your help,

Michel
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please send me this RTF file to [email protected]
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Hi,

I do not have application with RxRichEdit, but I tried WordPad instead. Both of them are based on richedit control (as far as I understand, standard TRichEdit is based on version 1 of richedit, TRxRichEdit is based on version 2 of richedit, WordPad is based on newer version of RichEdit).
In your file, line spacing is 95% (lines are condensed).
When I print from WordPad and from TRichView, document from WordPad has more height than from TRichView. But when I set LineSpacing=100% in TRichView, the results are exactly like in WordPad.
So WordPad (and I believe RxRichEdit too) ignores condensed line spacing.
Post Reply