addShape
- 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
addShape
BASIC / ADVANCED / PREMIUM
Inserts different types of shapes into a Word document.
Description
public void addShape(String type, OptionsShape options)
This method inserts a shape into your Word document.
The available types include:
- arcs of a circle (filled or not)
- bezier curves (filled or not)
- straight lines
- polylines
- rectangles
- rectangles with rounded corners
- arbitrary shapes (VML paths)
- ovals
Parameters
type
arc, curve, line, polyline, rect, roundrect, shape, oval.
options
Option | Type | Description |
---|---|---|
width | Integer | Shape width given in points. |
height | Integer | Shape height given in points. |
position | String | The possible values are: absolute, relative. |
marginTop | Integer | The possible values are: absolute, relative. |
marginLeft | Integer | Left margin given in points. |
zIndex | Integer | Equivalent to the CSS z-index property. Choose a high positive number to make sure that the shape is over the text or a negative number if you want the shape to be behind the text. |
strokeColor | String | The chosen line color in hexadecimal value: #ff0000, #00ffff. |
strokeWeight | Double | The width of the line in points: 1.0 pt, 3.5 pt... |
fillColor | String | The chosen fill color in hexadecimal value: #ff0000, #00ffff. |
textContent | WordFragment | Text content to be added into the shape. |
Options for specific types:
Option | Type | Description |
---|---|---|
arc | ||
startAngle | Integer | The angle of the tangent line at the initial point of the arc. |
endAngle | Integer | The angle of the tangent line at the final point of the arc. |
line and curve | ||
from | String | The x and y coordinates of the initial point in the format "x,y". |
to | String | The x and y coordinates of the final point in the format "x,y". |
control1 | String | The final control point for the bezier curve (it does not apply for plain lines) in the format "x,y". |
control2 | String | The final control point for the bezier curve (it does not apply for plain lines) in the format "x,y". |
roundrect | ||
arcsize | Double | A number describing the "roundness" of the rectangle corners: 0.5, 1.8, …y". |
shape | ||
path | String | The VML path describing the shape. You need a working knowledge of the VML standard. |
coordsize | String | The VML path describing the shape. You need a working knowledge of the VML standard. |