IWPDataBlock Interface

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

Manage header and footer and text layers


TextDynamic uses layers for header and footer texts. Layers are also used for text boxes and footnotes. This interface gives access to one layer element, called RTFDataBlock. This interface is used by Memo.ActiveText and also Memo.BlockAdd, Memo.BlockAppend and Memo.BlockFind.


An interface to this element can be useful to create header or footer in code. You can use the method Clear to erase the text. Use Delete to remove the layer completely.


You can append one paragraph using AppendParagraph. This can be useful to modify the text without having to move the cursor. Alternatively, to select the first paragraph with SelectFirstPar. In both cases the interfaces CurrPar and CurrParAttr can be used for low level text creation and formatting which does not require the change of the current cursor position. You can use the low level move methods to locate a different paragraph! (Make sure to call ReformatAll after the text has been updated.)


To move the cursor into the layer set property WorkOnText to true.


The property Kind is used to differentiate between header (DataBlockKind.wpIsHeader), footer (DataBlockKind.wpIsFooter), text boxes (DataBlockKind.wpIsOwnerSelected) and footnotes (DataBlockKind.wpIsFootnote). Also the body text uses the IWPDataBlock interface. It is the only layer which may span pages and its kind is DataBlockKind.wpIsBody.


So, if you need to check if the cursor is currently in the body text you can use a condition such as:

IWPDataBlock block = wpdllInt1.CurrMemo.ActiveText;

if (block!=null)&&(block.Kind == DataBlockKind.wpIsBody))


 // some code




This action starts the "manage header and footer" dialog: wpaDiaManageHeaderFooter







[idh_interface_iwpdatablock.htm]    Copyright © 2007 by WPCubed GmbH