IWPFieldContents Interface

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

Work with mail merge fields


This interface is passed as parameter Contents to the event OnFieldGetText. It is used to provide the field data when doing mail merge or reporting.


To update the contents of the field simply assign a string to property StringValue - this also works for formatted text.


You can use the method ContinueOptions to change the way the text is inserted, for example to ignore some of the loaded attributes.


It is also possible to create or update an image which is placed inside the field. To make this as easy as possible there are two functions LoadImage and LoadPicture. Both methods will not simply replace the contents of the field with a new image but reuse an existing image container object.


To create a hyperlink inside the field use InputHyperlink. You can also load a file with formatted text using LoadText


To create a table with data inside the field execute AddTable. The event OnCreateNewCell can be used to format and fill each new cell.


If you know that you do not need the field after the merge process you can execute DeleteField. The field markers, not the contents will be removed.


An interface to access the current field is provided as property FieldObject. You can use this interface to read other properties of the merge field.


The reporting engine will also trigger the event OnFieldGetText to evaluate fields which were used in band conditions such as ?fieldname=null and ?fieldname#null. In this case the property IsMergefield  =false. In this case use ExecStrCommand to modify the state property.





[idh_interface_iwpfieldcontents.htm]    Copyright © 2007 by WPCubed GmbH