Page 1 of 1

Documents with Headers and Footers

Posted: Thu Sep 06, 2018 7:32 am
by dasSYSTeam
Hello Sergey,

I asked a question a few days ago. May be, you could not read it yet and so I ask again.

First thank you for the demo to generate documents with Header and footer. It helps and works, but I have still a Problem with creating srichviewedit at runtime.
I took the demo and made the following changes. I deleted the SRichViewEdit1 - component from the form and builded the Editor at runtime like this

.... TForm7
public
{ Public declarations }
SRichViewEdit1 : TSRichViewEdit;
procedure GenerateHeader(RVData: TCustomRVData; IncludeCompanyData: Boolean);
procedure GenerateFooter(RVData: TCustomRVData);
procedure GenerateMain(RVData: TCustomRVData);
procedure InsertMain(RichViewEdit: TCustomRichViewEdit);
procedure GenerateDoc;
end;

procedure TForm7.FormCreate(Sender: TObject);
begin
SRichViewEdit1:=TSRichViewEdit.Create(Self);
SRichViewEdit1.Align:=alClient;
SRichViewEdit1.Parent:=TWinControl(Self);
GenerateDoc;
end;

If you run this and scroll to the second page of the document, the normalheader is not correct shown and editing the document leeds to effects, where the height of the headers (the same with the footers) is counted incorrect. For example if you try to add text at the end of the first page.
If you click into the second page, the normal hader is shown correct, but the Header at the first page is cut.

Unfortunately i made a object, wich contains SRichViewEditor and Buttons and others and many functions to work with documents. This object is not a visual component and I have to create it at runtime and it creates the SRichViewEditor too. Everything worked fine, but now I have to solve this Problem. Can you please help me?

Thank you

Bernd Graupe
dasSYSTeam GbR

Re: Documents with Headers and Footers

Posted: Fri Sep 07, 2018 5:07 pm
by Sergey Tkachenko
I am sorry for the delay, I'll answer tomorrow.

Re: Documents with Headers and Footers

Posted: Sun Sep 09, 2018 11:33 am
by Sergey Tkachenko
For TSRichViewEdit controls created in code, it's necessary to call Loaded method:

Code: Select all

 SRichViewEdit1:=TSRichViewEdit.Create(Self);
 SRichViewEdit1.Align:=alClient;
 SRichViewEdit1.Parent:=TWinControl(Self);
 SRichViewEdit1.Loaded;
 GenerateDoc;