Documents with Headers and Footers

General TRichView support forum. Please post your questions here
Post Reply
dasSYSTeam
Posts: 7
Joined: Fri Oct 20, 2017 9:12 am

Documents with Headers and Footers

Post 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
Attachments
MakeSRVDocRunTime.zip
(9.88 KiB) Downloaded 1193 times
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Documents with Headers and Footers

Post by Sergey Tkachenko »

I am sorry for the delay, I'll answer tomorrow.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Documents with Headers and Footers

Post 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;
Post Reply