Hi! It's possible to configure header to appear in all pages, and the footer only in the last page??
Thanks
Hi! It's possible to configure header to appear in all pages, and the footer only in the last page??
Thanks
You need to create special header/footer.
You can do so with WPRichText.HeaderFooter.Get(wpIsFooter, wpraOnLastPage,'').RTFText.AsString := 'On last page';
Such header/footer are not RTF conform. RTF only does all, first, odd and even.
Julian Ziersch
Thanks Julian! It worked!! But, only when the document have more than one page. When the document have just one page, the footer dosen't show. How can I fix this??
Thanks
EDIT:
The code below seems to wrk. But, in wich event I should call it for better performance??
WPRichText1.HeaderFooter.Get(wpIsHeader, wpraOnAllPages,'').RTFText.AsString := 'Header On All Pages';
if WPRichText1.PageCount > 1 then
begin
WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnFirstPage,'').RTFText.AsString := '';
WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnLastPage,'').RTFText.AsString := 'Footer On Last Page';
end
else WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnFirstPage,'').RTFText.AsString := 'Footer On Last Page';
Hi,
You can always use the OnGetSpecialText event to select the footer, or better disable the footer on all pages except for the last.
Julian
Thanks Julian!! I used the code below and it's working very well! If you think that it's not okay or there is a better solution, please tell me!
procedure TForm1.FormCreate(Sender: TObject);
begin
WPRichText1.HeaderFooter.Get(wpIsHeader, wpraOnAllPages,'').RTFText.AsString := 'Header On All Pages';
WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnLastPage,'').RTFText.AsString := 'Footer on last page';
WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnAllPages,'').RTFText.AsString := '';
end;
procedure TForm1.WPRichText1GetSpecialText(Sender: TObject;
par: TParagraph; PosInPar, PageNr: Integer; Kind: TWPPagePropertyKind;
var IsLastPage, UseThis: Boolean; var SpecialText: TWPRTFDataBlock);
begin
case Kind of
wpIsHeader:
SpecialText := WPRichText1.HeaderFooter.Get(wpIsHeader, wpraOnAllPages,'');
wpIsFooter:
begin
if IsLastPage then
SpecialText := WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnLastPage,'')
else SpecialText := WPRichText1.HeaderFooter.Get(wpIsFooter, wpraOnAllPages,'');
end;
end;
UseThis := True;
end;
Alles anzeigen
Thanks again!!
I think it is perfect.