WPCubed Product Support

Problems with pagefooter on last page (event GetSpecialText)

Hey all!
I have problems with showing a special pagefooter on the last page - sometimes it appears, and sometimes it is the standard for all pages depending how much text I have formatted in the bodysection. The body section is filled up with only one large table. It seems that it depends on that.
I have tried to reformat all and refresh all but nothing helps :-(

How can I ensure that the pagefooter on the last page always appears?

I have used the following code:

procedure TfmOrders.WPRichTextGetSpecialText(Sender: TObject; par: TParagraph;
  PosInPar, PageNr: Integer; Kind: TWPPagePropertyKind; var IsLastPage,
  UseThis: Boolean; var SpecialText: TWPRTFDataBlock);
begin
  FWpInvoice.HeaderFooter.Get(wpIsHeader, wpraOnAllPages, '').RtfText.AsString := ‘FInvHeaderAllPages’;
  if not IsLastPage then begin
    FWpInvoice.HeaderFooter.Get(wpIsFooter, wpraOnAllPages, '').RTFText.AsString := ’FInvFooterAllPages’;
  end else begin
    FWpInvoice.HeaderFooter.Get(wpIsFooter, wpraOnLastPage, '').RTFText.AsString := ‘FInvFooterLastPage’;
  end;
  UseThis := True;
end;

thanks in advance for any help,

Michael

#1 ♥ 0
5.7k Views 2 users read 2 min
support

Hi,

The even OnGetSpecialText should not be used to create header or footer like in your code.

It is meant to select any existing element.

To do so assign it to the variable var SpecialText: TWPRTFDataBlock - which is not changed at all in your code.

If you modify SpecialText also set UseThis := True;

Julian

#2 ♥ 0

@wpsupport:
Hi,

The even OnGetSpecialText should not be used to create header or footer like in your code.

It is meant to select any existing element.

To do so assign it to the variable var SpecialText: TWPRTFDataBlock - which is not changed at all in your code.

If you modify SpecialText also set UseThis := True;

Julian

Do you have an example of how to assign the variable "special text" - it is nil. And set the text to the one which belongs to all/last page? Thanks in advance.
Michael

#3 ♥ 0
support

Somewhere else in your program, i.e. after loading a file, you can use this code to create 2 header elements:

FWpInvoice.HeaderFooter.Get(wpIsFooter, wpraOnAllPages, '').RTFText.AsString := ’FInvFooterAllPages’;
FWpInvoice.HeaderFooter.Get(wpIsFooter, wpraOnLastPage, '').RTFText.AsString := ‘FInvFooterLastPage’;

The event should read like this:

procedure TfmOrders.WPRichTextGetSpecialText(Sender: TObject; par: TParagraph;
PosInPar, PageNr: Integer; Kind: TWPPagePropertyKind; var IsLastPage,
UseThis: Boolean; var SpecialText: TWPRTFDataBlock);
begin
if Kind=wpIsFooter then
begin
if not IsLastPage then
SpecialText := FWpInvoice.HeaderFooter.Get(wpIsFooter, wpraOnAllPages, '')
else
SpecialText := FWpInvoice.HeaderFooter.Get(wpIsFooter, wpraOnLastPage, '');
UseThis := True;
end;
end;

#4 ♥ 0

Thanks for your help.
It seems to work now.
Michael

#5 ♥ 0
This category is archived. No new posts are possible.