replaceVariableByText
- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createDocx
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importHeadersAndFooters
- importStyles
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addTable
- addTableContents
- addText
- addTextBox
- addWordML
- embedHTML
- clearBlocks
- deleteTemplateBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- tickCheckbox
replaceVariableByText
BASIC / ADVANCED / PREMIUM
Replaces placeholder variables by text.
Description
public void replaceVariableByText(HashMap<String, String> variables)
public void replaceVariableByText(HashMap<String, String> variables, OptionsReplaceVariableByText options)
This method is designed to replace a set of placeholder variables by plain text.
Remember that the Javadocx template variables should be surrounded by $ symbols or whatever symbol you have chosen via the setTemplateSymbol method.
Parameters
variables
This must be a HashMap with the names of the placeholder template variables as keys and the plain text that should replace them as values.
options
Option | Type | Description |
---|---|---|
firstMatch | Boolean | If the variable appears more than once within the Word document and firstMatch is set to true, Javadocx will only replace the first ocurrence of the variable within the Word document. |
parseLineBreaks | Boolean | If true (default is false) parses the line breaks to include them in the Word document. |
target | String | Possible values are: document (default), header, footer, footnote, endnote, comment. This option sets the scope of the replacement procedure. |