traverse placeholder textfield field hint getTextFields enumeration Christoph Lutz How do I traverse all placeholders in a document

a placeholder is a special textfield which is usefull as a placeholder for content evaluated by a macro

ThisComponent.getTextFields.createEnumeration provides a an enumeration of all fields. Use this enumeration to get all fields of type "JumpEdit" which represent placeholders. Note that the enumeration does NOT provide the fields in order of occurence in the document!

Sub traversePlaceholders Dim vEnum as Variant Dim s as String vEnum = ThisComponent.getTextFields.createEnumeration REM Note: the enumeration is not sorted in the correct order of occurance! While vEnum.hasMoreElements() Dim vTextField as Variant vTextField = vEnum.nextElement REM This traverses all text-fields, but we only want placeholders. REM Placeholders are fields of type "JumpEdit" If vTextField.supportsService("{@see com.sun.star.text.TextField.JumpEdit}") Then Dim sName as String Dim sHint as String sName = vTextField.getPropertyValue("PlaceHolder") sHint = vTextField.getPropertyValue("Hint") s = s & sName & CHR$(10) End If Wend MsgBox s, 0, "Placeholders" End Sub
Initial version