Page Margins

General TRichView support forum. Please post your questions here
Post Reply
Shane Stump
Posts: 54
Joined: Mon Jul 31, 2006 2:10 am

Page Margins

Post by Shane Stump »

Is there a reason Page Margins aren't automatically stored in RVF file format for each document?

If not, is there an easy way to store the page margins for each document inside the document itself? Again, I am using the RVF format for storing documents into a database table.

Best Regards,

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

Post by Sergey Tkachenko »

Currently, page margins are assumed to be a property of application, not a property of document.

LeftMarginMM, etc. are properties of TRVPrint component, so TRichView cannot store them (TRichView does not have a link to TRVPrint).
In future, I plan to add new properties in TRichView. For now, you should save them yourself.
Below is an example how to do it using RichViewActions, but the main idea is simple and can be used without RichViewActions.

How to save RVPrint's margins in RVF files (not RTF):

1) Include rvfoSaveDocProperties and rvfoLoadDocProperties in
RichViewEdit1.RVFOptions
2) Write two procedures for saving and loading margins in
RichViewEdit1.DocProperties:

Code: Select all

procedure TForm3.DocPropToRVPrint;
var s: String;
begin
 s := RichViewEdit1.DocProperties.Values['LeftMarginMM'];
 RVPrint1.LeftMarginMM := StrToIntDef(s, 20);
 s := RichViewEdit1.DocProperties.Values['TopMarginMM'];
 RVPrint1.TopMarginMM := StrToIntDef(s, 20);
 s := RichViewEdit1.DocProperties.Values['RightMarginMM'];
 RVPrint1.RightMarginMM := StrToIntDef(s, 20);
 s := RichViewEdit1.DocProperties.Values['BottomMarginMM'];
 RVPrint1.BottomMarginMM := StrToIntDef(s, 20);
end;

procedure TForm3.RVPrintToDocProp;
begin
 RichViewEdit1.DocProperties.Clear;
 RichViewEdit1.DocProperties.Add('LeftMarginMM='+IntToStr(RVPrint1.LeftMargi
nMM));
 RichViewEdit1.DocProperties.Add('TopMarginMM='+IntToStr(RVPrint1.TopMarginM
M));

RichViewEdit1.DocProperties.Add('RightMarginMM='+IntToStr(RVPrint1.RightMarg
inMM));

RichViewEdit1.DocProperties.Add('BottomMarginMM='+IntToStr(RVPrint1.BottomMa
rginMM))
;
end;
3) Process rvActionPageSetup.OnChange.

Code: Select all

procedure TForm3.rvActionPageSetupChange(Sender: TObject);
begin
 RichViewEdit1.Change;
 RVPrintToDocProp;
end;
4) Process rvActionSave.OnDocumentFileChange
(this event is already processed in the ActionTest demo)
Add the code reading margins to RVPrint from DocProperties.

Code: Select all

procedure TForm3.rvActionSave1DocumentFileChange(Sender: TObject;
 Editor: TCustomRichViewEdit; const FileName: String;
 FileFormat: TrvFileSaveFilter; IsNew: Boolean);
begin
 ....
 DocPropToRVPrint;
end;
Shane Stump
Posts: 54
Joined: Mon Jul 31, 2006 2:10 am

Post by Shane Stump »

Finally got around to implementing the suggested code and it works as expected!

The screen still show the margins as they were, but the print preview shows the correct margins. Is there a way to fix that? That is, show the page margins set in the Page Setup dialog?

Best Regards,

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

Post by Sergey Tkachenko »

RichViewEdit's margins are different from margins on page. See the picture in the help topic about TRVPrint.
I think it does not make sense to show printing margins in editor. MS Word does not show them in "Normal" view mode as well (only in "Print Layout" mode)
Shane Stump
Posts: 54
Joined: Mon Jul 31, 2006 2:10 am

Post by Shane Stump »

I will have a look at the help.

I forwarded your response to a couple of my clients. The nice one wrote back that your response is "FULL OF C__P". Her second paragraph was

"But he is not correct. The text in MS Word adjusts accordingly when you adjust the margins. In our system (TRichView), it does not. You can not move the text when you expand the margins. What is the point of the margins if we can't adjust the text to them?????"


I personally don't use Word, but Open Office. Open Office Writer does as she describes when I change the Page Margins.

What I am trying to accomplish in my application is a Mini-Word. Is there any way to implement the page margins in the view the way people expect it to work?

Best Regards,

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

Post by Sergey Tkachenko »

TRichViewEdit was not designed as WYSIWYG editor. This means that, even if you set the proper page width and margins, text on screen may be wrapped in different places. But if you think that approximate solution is better than nothing, look here: http://www.trichview.com/forums/viewtopic.php?t=1282

TRichViewEdit-based WYSIWYG editor will be released very soon, may be before the Summer. But it is created by another developer, and this will not be a free update.
Shane Stump
Posts: 54
Joined: Mon Jul 31, 2006 2:10 am

Post by Shane Stump »

Sergey.

I am not worry about having to BUY and update or NEW component - I just want my customers happy and the two beta testing my product do NOT think what I currently have should be released as it is too confusing.

Will the new component be compatible with the existing TRichView component ?

The reason I am asking is that I just downloaded WPTools 5 and it works EXACTLY like my clients want. I would rather upgrade TRichView if possible.

Best Regards,

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

Post by Sergey Tkachenko »

This new component contains TRichViewEdit inside. And all RichViewActions work with this component as well as with TRichViewEdit.
Shane Stump
Posts: 54
Joined: Mon Jul 31, 2006 2:10 am

Post by Shane Stump »

Is there anyway to help beta test? As I have mentioned, I need to come up with a solution by July and I would rather stay with TRichViewEdit (even if I have to buy an additional / new component)!

Best Regards,

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

Post by Sergey Tkachenko »

Answered by e-mail
Post Reply