replacePlaceholderImage
- 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
replacePlaceholderImage
BASIC / ADVANCED / PREMIUM
Replaces a placeholder within a image by a new image.
Description
public void replacePlaceholderImage(String variable, String src) throws Exception
public void replacePlaceholderImage(String variable, String src, OptionsReplacePlaceholderImage options) throws Exception
This method allows to replace a placeholder image that may be fully formatted in Word (border, shadows, effects...) by an image of our choice.
The placeholder image should be tagged using the alternate text option of your Word interface (this may depend on your Word version).
Parameters
variable
The name of the variable that identifies the placeholder image.
src
The path to the image that you want to insert into the Word document.
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. |
target | String | Possible values are: document, header, footer, footnote, endnote or comment. |
width | Integer | The value in cm (float). |
height | Integer | The value in cm (float). |
dpi | Integer | Dots per inch. |
mime | string | Forces a mime (image/jpg, image/jpeg, image/png, image/gif) |