replaceVariableByWordML
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
replaceVariableByWordML
TRIAL / ADVANCED / PREMIUM
Replaces placeholder variables by plain WordML code.
Description
public replaceVariableByWordML (array $variables[, array $options])
This method (avalaible for the seasoned phpdocx user) allows the direct substitution of placeholder variables by WordML code.
Only use this method if you really understand the OOXML standard. phpdocx does not validate the WordML against any scheme so you have to make sure by your own that the WordML is correctly encoded. Moreover, this method does not take care by its own of internal/external relationships included in the WordML code.
Parameters
variables
This must be an array with the names of the placeholder template variables as keys and the WordFragment instances that should replace them as values.
options
The possible keys and values of this array are:
Key | Type | Description |
---|---|---|
firstMatch | boolean | If the variable appears more than once within the Word document and firstMatch is set to true, phpdocx will only replace the first occurrence of the variable within the Word document. |
target | string | Possible values are: document. This option sets the scope of the replacement procedure. |
type | string | Possible values are:
|