Remove all headers but keep header on first page

  • Hello

    I recently took over a project written in Delphi 2005/WPTools 5.
    Since I did not have Delphi 2005 I had to buy Delphi 2009 and upgrade the project to this. At the same time I upgraded the project to WPTools6.

    In the project there are a bit of code intended to remove headers and just keep the header on the first page:

    WPPrinterDocument.AssignToHeader(WPPrinterDocument.HeaderFooter.Get(wpIsHeader, wpraOnAllPages), wpraOnFirstPage);

    WPPrinterDocument.HeaderFooter.Get(wpIsHeader, wpraOnAllPages).Clear();

    //(WPPrinterDocument is a TWPRichText)

    This worked good in Delphi 2005/WPTools5 but in Delphi 2009/WPTools6 it just generates some control codes in the header on the first page when viewing.

    Was this a correct way to remove headers on page 2-n or should it be done in another way?

    Thanks

    Regards,
    Rikard

    • Offizieller Beitrag

    Hi,

    Delphi 2009 differes from Delphi 2005 in making all strings widestrins (2 bytes / character).

    This caused a lot of unreadable text in the past, it is possible that there are still problems since so much code is affected.

    I check your code.

    In the meantime You can use

    WPPrinterDocument.HeaderFooter.Get(wpIsHeader, wpraOnAllPages).Kind := wpraOnFirstPage;