Page 1 of 1

First Line Spacing in a paragraph!

Posted: Mon Jun 23, 2008 1:32 pm
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

Dots per inch (DPI)

Posted: Mon Jun 23, 2008 2:59 pm
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

Posted: Mon Jun 23, 2008 4:08 pm
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;

That was quick!

Posted: Mon Jun 23, 2008 5:09 pm
by Zala
Thank you for the quick answer, I'll try to solve my problem with the tools you have provided me!

Michel

Posted: Wed Jun 25, 2008 1:27 pm
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

Posted: Wed Jun 25, 2008 1:33 pm
by Sergey Tkachenko
Please send me this RTF file to [email protected]

Posted: Thu Jun 26, 2008 11:10 am
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.