How do I save/load a page format
Posted: Wed Mar 21, 2012 3:05 pm
How do I save/load a page format (orientation, margins, size etc)?
I store document in the way:
And load:
But the page format doesn't appear.
I'm aware I need to handle TRVAControlPanel.OnMarginsChanged and call SRVE.SetRVMargins from inside. But this event doesn't fire.
So what should I do to save/load the page format?
I store document in the way:
Code: Select all
procedure TDocEditFrame.SaveFile(const FileName: string);
var
fs: TFileStream;
begin
fs := TFileStream.Create(FileName, fmCreate or fmOpenWrite);
try
SRVE.RVHeader.SaveRVFToStream(fs, False);
SRVE.RVFooter.SaveRVFToStream(fs, False);
SRVE.RichViewEdit.SaveRVFToStream(fs, False);
finally
fs.Free;
end;
end;
Code: Select all
procedure TDocEditFrame.LoadFile(const FileName: string);
var
fs: TFileStream;
begin
fs := TFileStream.Create(FileName, fmOpenRead);
try
SRVE.RVHeader.Clear;
SRVE.RVFooter.Clear;
SRVE.RichViewEdit.Clear;
SRVE.RVHeader.LoadRVFFromStream(fs);
SRVE.RVFooter.LoadRVFFromStream(fs);
SRVE.RichViewEdit.LoadRVFFromStream(fs);
SRVE.RVHeader.Format;
SRVE.RVFooter.Format;
SRVE.RichViewEdit.Format;
SRVE.SetRVMargins;
finally
fs.Free;
end;
end;
I'm aware I need to handle TRVAControlPanel.OnMarginsChanged and call SRVE.SetRVMargins from inside. But this event doesn't fire.
So what should I do to save/load the page format?