 | OO-Snippets: traverse placeholders (unordered)Commons| Keywords | traverse, placeholder, textfield, field, hint, getTextFields, enumeration |
|---|
| Language | OOBasic |
|---|
| Application | Writer |
|---|
| Authors | Christoph Lutz (initial)
|
|---|
| Supported Versions | 2.0.x |
|---|
| Supported OS | All |
|---|
| Question | 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
|
|---|
| Answer | 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
While vEnum.hasMoreElements()
Dim vTextField as Variant
vTextField = vEnum.nextElement
If vTextField.supportsService("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
|
Changelog| Date | User | Modification |
|---|
| 2005-05-27 | CL | Initial version |
|