RTF Formatting question

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

RTF Formatting question

Post by toolwiz »

I'm looking at the PDF demo, and I notice this in the block to read an RTF file:

Code: Select all

             srve.RichViewEdit.Clear;
             srve.RichViewEdit.DeleteUnusedStyles(True, True, True);
             srve.RichViewEdit.LeftMargin := 132;
             srve.RichViewEdit.RightMargin := 57;
             srve.RichViewEdit.TopMargin := 94;
             srve.RichViewEdit.BottomMargin := 94;
             srve.RichViewEdit.LoadRTF(OpenDialog1.FileName);
             srve.RichViewEdit.Format;
The latest version of RV/RVE has DocParameters to get the margins and such from the RTF file. So my question is, are these now loaded automatically? Or can they be set after the call to LoadRTF? Specifically, which of these is most appropriate:

Code: Select all

             srve.RichViewEdit.Clear;
             srve.RichViewEdit.DeleteUnusedStyles(True, True, True);
             srve.RichViewEdit.LoadRTF(OpenDialog1.FileName);
             srve.RichViewEdit.Format;
or

Code: Select all

             srve.RichViewEdit.Clear;
             srve.RichViewEdit.DeleteUnusedStyles(True, True, True);
             srve.RichViewEdit.LoadRTF(OpenDialog1.FileName);
             srve.RichViewEdit.LeftMargin := Floor(srve.RichViewEdit.DocParameters.LeftMargin);
             srve.RichViewEdit.RightMargin := Floor(srve.RichViewEdit.DocParameters.RightMargin);
             srve.RichViewEdit.TopMargin := Floor(srve.RichViewEdit.DocParameters.TopMargin);
             srve.RichViewEdit.BottomMargin := Floor(srve.RichViewEdit.DocParameters.BottomMargin);
             srve.RichViewEdit.Format;
Thanks
-David
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

I tried this both ways, and they seem to be equivalent, leading me to believe the library already accounts for DocParameters.

(The code I gave needs to have the numbers converted from the input units to pixels, and I did that.)

I noticed, however, that while the Top, Bottom, and Left margins look ok, the Right margin is not respected.

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

Post by Sergey Tkachenko »

TRichView itself never reads LeftMargin and other margin properties from RTF. It can read DocParameters property if RTFReadProperties.ReadDocParameters = True.
As for ScaleRichView specifics, I'll ask Ilya.
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

Thanks, I have corrected a bug. ScaleRichView incorrectly read out values of Margins and incorrectly save them in DocParameters for RTF files. In the nearest updating it will be fixed.
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

So what is the recommended approach after the fix is released?

-David
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

Sorry :( , recommendations are not present. Updating will be this week.
Post Reply