OnTextObjectGetText Event

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

Declaration C#

OnObjectGetText(Object Sender, int Editor, int PageNr, IWPTextObj TextObj)


Declaration OCX

OnTextObjectGetText(ByVal Editor As Long, ByVal CurrPage As Long, ByVal Obj As WPTDynInt.IWPTextObj)


This event can be used to display custom text inside of text objects. There are several standard objects, such as the page number, the page count, time and date fields. All this objects are - in contrast to merge fields - handled as one character only. This means the contents cannot contain a line wrap. But unlike merge fields, which really contain text, the text displayed by the text objects is retrieved before the object is painted. You can see the effect with the TIME field - here the current time is updated every time the screen is refreshed.


The contents of the object with an unknown name (not PAGE, NUMPAGES etc) is by default retrieved from the object property Params. This property is read from and written to RTF. Inside the event OnTextObjectGetText you can update the property Params to display custom information, for example the current file path, the name of the author or any text you need.


This VB code inserts a text object:

WPDLLInt1.TextCursor.InputFieldObject "DYNAMIC", "", ""


This event simply displays <undefined: ...>

Private Sub WPDLLInt1_OnTextObjectGetText(ByVal Editor As Long, ByVal CurrPage As Long, ByVal Obj As WPTDynInt.IWPTextObj)

  Obj.Params = "<undefined:" + Obj.Name + ">"

End Sub

[idh_wpdllint_ontextobjectgettext.htm]    Copyright © 2007 by WPCubed GmbH