XmlApi - pdx:replaceVariableByText
- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- docxSettings
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- addBookmark
- addBreak
- addChart
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addStructuredDocumentTag
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordML
- embedHTML
- clearBlocks
- deleteBlock
- modifyInputFields
- processTemplate
- rawSearchAndReplace
- removeTemplateVariable
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
pdx:replaceVariableByText
Replaces placeholder variables by text.
Note
You are reading the XMLAPI documentation. For the API method please go to replaceVariableByText.
Description
Element definition
This element is designed to replace a set of placeholder variables by plain text.
Remember that the phpdocx template variables should be surrounded by $ symbols or whatever symbol you have chosen via the setTemplateSymbol element.
Attributes and sub-elements
variableName
The template variable name to be replaced by the text content.
options
The possible keys and values of this array are:
Key | Description |
---|---|
firstMatch | If the variable appears more than once within the Word document and firstMatch is set to true, phpdocx will only replace the first ocurrence of the variable within the Word document. |
parseLineBreaks | If true (default is false) parses the line breaks to include them in the Word document. |
target | Possible values are: document (default), header, footer, footnote, endnote, comment. This option sets the scope of the replacement procedure. |
raw | If true (default is false) replaces the variable by a string regardless the variable scope (tag values, attributes...). Only allows to replace a variable by a plain string. Use with caution. |