setTemplateSymbol
- 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
setTemplateSymbol
Sets the character or characters used to identify placeholder variables within a given template.
By default the phpdocx template variables have to be wrapped by dollar symbols ($).
You can change that symbol by any other you wish with the help of this method.
The character or symbol used to wrap template variables may be:
- The same at the beginning and the end (setting only $templateSymbolStart): $VAR$, |VAR|, #VAR#... A single 1 byte character.
- Different at the beginning and the end: ${VAR}, #{VAR}, [[VAR]], «VAR»...
templateSymbolStart
The character or symbol to be used for identifying placeholder variables within templates. If templateSymbolEnd is null, it uses templateSymbolStart at the beginning and the end of the variable.
templateSymbolEnd
The character or symbol to be used at the end for identifying placeholder variables within templates. If null, it uses templateSymbolStart at the beginning and the end of the variable. If it has a value, it uses templateSymbolStart at the beginning and templateSymbolEnd at the end.
phpdocx recommends using ${ } to wrap placeholders that don't use the same symbol at the beginning and the end. For further information, please read the documentation available on Defining a non unique symbol for placeholders.
- phpdocx 14.5:
- generate a new CreateDocxFromTemplate::$regExprVariableSymbols value automatically.
- placeholders in text boxes with placeholder symbols using text box symbols.
- phpdocx 11.0:
- supported ${ } to wrap placeholders.