insertWordFragment
- 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
insertWordFragment
ADVANCED / PREMIUM
BASIC
Inserts elements in the document.
Description
public void insertWordFragment(WordFragment wordFragment, OptionsDOCXPath referenceNode)
public void insertWordFragment(WordFragment wordFragment, OptionsDOCXPath referenceNode, Boolean forceAppend)
Parameters
wordFragment
WordFragment to be inserted.
referenceNode
Option | Type | Description |
---|---|---|
type | String | * (all, default value), break, chart, endnote (content reference, the whole paragraph is removed), footnote (content reference, the whole paragraph is removed), image, list, paragraph (also for bookmarks, links and lists), section, shape, table. |
contains | String | Contains a text string. |
occurrence | String | Exact occurrence or range of contents (e.g.: 2..9, 2.., ..9) or first() or last(). If empty iterate all elements. |
attributes | HashMap<String, String> | Contains a specific attribute key and value. |
parent | String | Main document body as default, allows to set any parent or a specific one. w:body (default), '/' (any parent) or any other specific parent (/w:tbl/, /w:tc/, /w:r/...). |
customQuery | String | Custom xpath query, overwrites any other reference. |
location | String | after (default) or default. |
forceAppend
If true appends the WordFragment if the reference node could not be found (false as default).
Code samples
Example #1
Example #2