replaceVariableByExternalFile
- 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
replaceVariableByExternalFile
BASIC / ADVANCED / PREMIUM
Replaces an array of variables by external files.
Description
public void replaceVariableByExternalFile(HashMap<String, String> variables) throws Exception
public void replaceVariableByExternalFile(HashMap<String, String> variables, OptionsReplaceVariableByExternalFile options) throws Exception
With the help of this method one may replace a single placeholder variable by a whole external document.
This method accepts the following document formats: DOCX, RTF, HTML and MHT.
This method is only compatible with MS Word 2007 and newer.
Parameters
variables
This is a HashMap with the placeholder variables as keys and the path to the corresponding external document as value.
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. |
matchSource | Boolean | If true (default value) tries to preserve as much as possible the formatting of the inserted document. |