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:


    thanks in advance for any help,

    Michael

  • 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

    • Offizieller Beitrag

    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;