Property WorkOnText

<< Click to Display Table of Contents >>

Navigation:  Programming > Create text under program control > Header/Footer API >

Property WorkOnText

Properties TWPRichText.WorkOnText and TWPRTFDataBlock.WorkOnText

 

This property selects the text which is currently edited. All commands will operate on the selected text part. Only ‚Load' and ‚Save' will automatically select the body.

 

Possible values for 'WorkOnText' are

 wpIsBody

 wpIsHeader

 wpIsFooter

 

If you need to select the special text for a certain 'range' you the property HeaderFooterTextRange. (type TWPPagePropertyRange).

 WPRichText1.HeaderFooterTextRange := wpraOnOddPages;

 WPRichText1.WokOnText := wpIsHeader;

 

Now all the procedures work with the header for odd pages. You can execute mailmerge "MergeText", add number fields "InputTextFieldName('PAGE')" or inserts texts "InputString'Hello World')".

 

If you have a reference to a certain TWPRTFDataBlock -  for example provided by WPRichText1.HeaderFooter.Get - you can also set the Boolean property WorkOnText of this element to TRUE to select it for editing!  

 

  WPRichText1.HeaderFooter.Get(wpIsHeader,wpraOnFirstPage,'').WorkOnText := TRUE;

  WPRichText1.InputString('WPTools Documentation');

  WPRichText1.WorkOnText := wpIsBody;

 

Please note that you will only see the selected text exclusively in the 'normal' LayoutMode. Otherwise the cursor simply moves to the header or footer region.