Name Property

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

Applies to

IWPDataBlock

Declaration

string Name;

Description

The name can be used to locate a certain data block to be used as header or footer.

 

This code creates a new header text. The text which is assigned to "Text" may be RTF text or may contain HTML formatting tags and the following proprietary closed HTML tags: pagenr, pagecount, tab and field.

 

<pagenr/>: Print the current page number

<pagecount/>: Print the page count

<tab/>: Insert a tabchar and create a tabstop: left, right, center, decimal=twips-value

<field/>: create a merge field. Use name and command parameter.

CustomHeader

// Create a custom header which will be printed only on page #2

IWPDataBlock block = wpdllInt1.Memo.BlockAdd(

     DataBlockKind.wpIsHeader,

     DataBlockRange.wpraNamed,

     "CUSTOM", 0);

block.Clear();

block.Text = "Custom <b>Header</b><tab right=9000/>page <pagenr>/<pagecount>";

 

 

This event handler selects the "custom" header for page number 2 only.

private void wpdllInt1_OnGetSpecialText(

  object Sender,

  int Editor,

  int PageNr,

  WPDynamic.DataBlockKind Kind,

  ref int SelectedID)

{

 if((Kind==DataBlockKind.wpIsHeader)&&(PageNr==2))

    {

  SelectedID=wpdllInt1.Memo.FindHeader(

     (int)DataBlockRange.wpraNamed,

     "CUSTOM" // name to find

     );

     }

}


[idh_iwpdatablock_name.htm]    Copyright © 2007 by WPCubed GmbH