A couple of questions please concerning headers and footers.

    • Offizieller Beitrag
    Zitat

    1). ScreenResMode, SetPageNumber, CheckForHeader, CheckForFooter, AssignHeaderTo and AssignFooterTo no longer exist. What are the alternatives?

    ScreenResMode is obsolete and will not be added - but - WPTools 5 always works with a logical resolution. Currently it can only use the screen resolution but it can also use the printer- or any other resolution to format the page. It makes no difference wher the text is then printed on.

    CheckForFooter etc have to be replaced by code which is using the HeaderFooter collection. Please refer to manual.

    CheckFor ... can be implemented as a lopp over all items until the "Kind" is wpIsFooter and the Range is the range you need. (all pages etc)

    Zitat

    2). I assume that a TWPRichText still has a header, body and footer and not a separate TWPRichText for each section. ?


    Please see the manual and read about 'DataStructures'. A header (and there can be many of them) is stored in a TWPRTFDataBlock which are all hosted by the TWPRTFDataCollection.
    A TWPRichText is just a wrapper around the RTF-Engine, the RTF Engine handles all on its own. It is even possible to render text without a TWPRichText. The TWPRichTextLabel inherits from the RTF-Engine directly.

    Zitat

    3). I had some problems getting to grips with how headers and footers worked with previous versions of WPTools. Is it possible to have some sample code on headers and footers for version 5, please ?

    The code which worked for V4 works now, too. Of course if the HeaderFooter collection is used.

    Zitat

    4). The unit just added in WPTools Vers 5 rel 3 WPManHeadFoot, what does it cater for and is there any information on it.

    It is an example for the use of the header and footer. Please open the unit and see yourself. All header and footer are listed kn a listbox, can be displayed, added and deleted and of course edited.

    Zitat

    I am using WpRtfStorage objects to store the header and footer
    contents while changing between wpraOnAllPages and wpraOnFirstPage.

    I suggest to use strings to store the text. The WpRtfStorage is used for much more complivcatwed tasks, for example to create links to several TWPRichText to edit a text path. You can simply set up strings with the HeaderFooter[x].RTFText.AsString contents and assign this when required.

    This code create a header or footer:

    Code
    var item : TWPRTFDataBlock;item := WPRichText.HeaderFooter.Get(TWPPagePropertyKind,     TWPPagePropertyRange, '' );

    This code reads the include header and footer: