Header & Footer

[Top]  [Chapter]  [Previous]  [Next]

Here we talk about the header and footer areas which may be printed on certain or all pages.


They are implemented as layers which means in general they need to be activated to be editable.

Here You see a header text in edit mode.



Internally headers and footers are implemented as "RTF Data Block" objects, just like the body of the document.

This API is used to add and find such objects: BlockAdd, BlockAppend, BlockFind

To delete a block (such a header or footer text) call the "Delete" method published by the interface IWPDataBlock.


You can also use this API to create header and footers:




To leave the header or footer use IWPTextCursor.GotoBody.


Normally the user can switch any header or footer element into edit mode by double clicking on it. This can also be switched off, using Memo.SetBProp(2,3,1), also see wpEditOptionsEx. While editing the body, the user sees the header and footer in shades of gray. This mode can be disabled using Memo.SetBProp(6, 19, 1), also see wpViewOptions.


To switch the layer into edit mode under program control, set the property WorkOnText to true. Now all text insertion and manipulation (InputText ...)  is performed in the selected RTFDataBlock.


You can now insert page numbering:

     IWPTextCursor TextCursor;

     TextCursor = WpdllInt1.Memo.TextCursor;

     TextCursor.InputFieldObject("PAGE", "", "1");


     TextCursor.InputFieldObject("NUMPAGES", "", "9");


There is also a dialog to create, locate and delete header and footer elements.


It is displayed by the wpaDiaManageHeaderFooter Action. You can show it with wpaProcess("DiaManageHeaderFooter", "").


A header text may also contain images. If this images are managed relatively to the page they can also be moved down the body of the document. This feature can be used to create watermarks. (BTW: The integrated PDF engine will make sure, the image is not embedded only once.)


To create a header or footer only for a certain section, the section ID may be specified for the layer.



[header__footer.htm]    Copyright © 2007 by WPCubed GmbH