JSON API - customizeWordContent
- addBarcode
- addBookmark
- addBreak
- addCaption
- addChart
- addComment
- addCrossReference
- addDateAndHour
- addDropCap
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addPageNumber
- addRuby
- addSimpleField
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordML
- addWordFragment
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setCompatibilityMode
- setDefaultFont
- setDocumentDefaultStyles
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHTML
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
customizeWordContent
PREMIUM
TRIAL / ADVANCED
Changes content styles on the fly in the document.
Note
You are reading the JSON API documentation. For the PHP API method please go to customizeWordContent.
| Key | Description |
|---|---|
| type |
|
| contains | Contains a text string. |
| occurrence |
|
| attributes | Contains a specific attribute key and value. |
| parent | 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 | Custom xpath query, overwrites any other reference. |
| target |
|
| reference | To be used with header and footer targets: positions (array) 1, 2... based on the sectPr contents order, sections (array) 1, 2..., types (array) first, even, default |
options
Changes to be applied.
break elements
| Key | Description |
|---|---|
| type | line, page |
image elements
| Key | Description |
|---|---|
| borderColor | hexadecimal color: FF0000. |
| borderStyle | Possible values are:
|
| borderWidth | Given in emus (1cm = 360000 emus). |
| height | Given in emus (1cm = 360000 emus). |
| imageAlign | Image alignment: right, center,... |
| spacingBottom | Given in emus (1cm = 360000 emus). |
| spacingLeft | Given in emus (1cm = 360000 emus). |
| spacingRight | Given in emus (1cm = 360000 emus). |
| spacingTop | Given in emus (1cm = 360000 emus). |
| width | Given in emus (1cm = 360000 emus). |
list elements. The same options as 'paragraph' and:
| Key | Description |
|---|---|
| depthLevel | Depth level. |
| type | 0 (clear), 1 (inordinate) (default), 2 (numerical) or the name of the created list. |
numbering elements
| Key | Description |
|---|---|
| levelAlign | Level align. |
| levelText | Level text. |
| numberingFormat | Numbering format. |
| numberingStart | Numbering start value. |
paragraph elements
| Key | Description |
|---|---|
| backgroundColor | Hexadecimal color: FF0000. |
| bidi | If true enables bidi. |
| bold | If true the text will be shown in bold characters. |
| caps | If true displays text in capital letters. |
| color | Hexadecimal color value: 'FF0000', '000000'... |
| dstrike | If true displays text in doubleStrikeThrough. |
| em | Emphasis mark type: none, dot, circle, comma, underDot. |
| font | Font family: 'Arial', Calibri'... |
| fontSize | Font size in points. |
| headingLevel | The heading level. |
| italic | If true displays the text in italics. |
| keepLines | Keeps (whenever possible) all the current paragraph lines on the same page. |
| keepNext | Keeps (whenever possible) in the same page the current paragraph with next paragraph. |
| lineSpacing |
|
| pageBreakBefore | If true forces a page break before the paragraph. |
| pStyle | Paragraph style. |
| rtl | If true enables RTL. |
| smallCaps | If true displays text in small capital letters. |
| spacingBottom | Bottom padding in twentieths of a point. |
| spacingTop | Top padding in twentieths of a point. |
| strike | If true displays text in strikethrough. |
| textAlign | Text alignment within paragraph. Possible values are: center, right, both and distribute. |
| underline | Underlines text. Possible values are: single, words, double, dotted, dash and wave. |
| underlineColor | Underlines text with a color: 'FF0000', '000000'... |
| vanish | Uses a vanish style. |
| widowControl | Widow control. |
run elements
| Key | Description |
|---|---|
| bold | If true the text will be shown in bold characters. |
| caps | If true displays text in capital letters. |
| characterBorder | Adds a border to the character. Keys and values: "type" => none, single, double, dashed..., "color" => ffffff, ff0000, "spacing"=> 0, 1, 2..., "width" => in eights of a point. |
| color | Hexadecimal color value: 'FF0000', '000000'... |
| dstrike | If true displays text in doubleStrikeThrough. |
| em | Emphasis mark type: none, dot, circle, comma, underDot. |
| font | Font family: 'Arial', Calibri'... |
| fontSize | Font size in points. |
| highlight | Colors: black, blue, cyan, green, magenta, red, yellow, white, darkBlue, darkCyan, darkGreen, darkMagenta, darkRed, darkYellow, darkGray, lightGray, none. |
| italic | If true displays the text in italics. |
| position | Position value. Positive value for raised and negative value for lowered. |
| rStyle | Run style. |
| rtl | If true enables RTL. |
| scaling | Scaling value, 100 is the default value. |
| smallCaps | If true displays text in small capital letters. |
| spacing | character spacing, positive value for expanded and negative value for condensed. |
| strike | If true displays text in strikethrough. |
| underline | Underlines text. Possible values are: single, words, double, dotted, dash and wave. |
| underlineColor | Underlines text using a color: : 'FF0000', '000000'... |
| vanish | Uses a vanish style. |
section elements
| Key | Description |
|---|---|
| gutter | Gutter in twips (used for binding). |
| height | Section height in twips. |
| marginBottom | Bottom margin for this section in twips. |
| marginFooter | Footer margin in twips. |
| marginHeader | Header margin in twips. |
| marginLeft | Left margin for this section in twips. |
| marginRight | Right margin for this section in twips. |
| marginTop | Top margin for this section in twips. |
| numberCols | Number of columns for the section. |
| orient | Section page orientation (portrait or landscape). |
| space | Column spacing in twips (used for binding). |
| vAlign | Vertical alignment:
|
| width | Section width in twips. |
style elements. The same options as 'paragraph'.
table elements
| Key | Description |
|---|---|
| border | Border type: none, single, double, dashed, threeDEngrave, threeDEmboss, outset, inset... This value can be overridden for each side with the use "borderTop", "borderRight", "borderBottom" and "borderLeft" properties. |
| borderColor | Hexadecimal color value: "FF0000", "000000"... This value can be overridden for each side with the use of "borderTopColor", "borderRightColor", "borderBottomColor" and "borderLeftColor" properties. |
| borderSpacing | Border spacing in points. This value can be overridden for each side with the use of "borderTopSpacing", "borderRightSpacing", "borderBottomSpacing" and "borderLeftSpacing" properties. |
| borderWidth | Border size in eigths of a point. This value can be overridden for each side with the use of "borderTopWidth", "borderRightWidth", "borderBottomWidth" and "borderLeftWidth" properties. |
| cellMargin | An integer or an array with keys: top, right, bottom and left. The values are given in twentieths of a point. |
| cellSpacing | Separation among cells. Given in twentieths of a point (twips). |
| columnWidths | An integer or a zero-based array with the widths of each column in twentieths of a point. |
| indent | Left table margin in twentieths of a point (twips). |
| tableAlign | Table alignment. Possible values are: center, left or right. |
| tableStyle | Table style. |
| tableWidth | Its possible keys and values are:
|
table-row elements
| Key | Description |
|---|---|
| height | Height in twentieths of a point. |
| minHeight | Minimum height in twentieths of a point. |
table-cell elements
| Key | Description |
|---|---|
| backgroundColor | Hexadecimal color value: 'FF0000', '000000'... |
| border | Border type: none, single, double, dashed, threeDEngrave, threeDEmboss, outset, inset... This value can be overridden for each side with the use "borderTop", "borderRight", "borderBottom" and "borderLeft" properties. |
| borderColor | Hexadecimal color value: "FF0000", "000000"... This value can be overridden for each side with the use of "borderTopColor", "borderRightColor", "borderBottomColor" and "borderLeftColor" properties. |
| borderSpacing | Border spacing in points. This value can be overridden for each side with the use of "borderTopSpacing", "borderRightSpacing", "borderBottomSpacing" and "borderLeftSpacing" properties. |
| borderWidth | Border size in eigths of a point. This value can be overridden for each side with the use of "borderTopWidth", "borderRightWidth", "borderBottomWidth" and "borderLeftWidth" properties. |
| cellMargin | An integer or an array with keys: top, right, bottom and left. The values are given in twentieths of a point. |
| fitText | If true fits the text to the size of the cell. |
| rowspan | The row span of that particular table cell. |
| vAlign | Vertical align of text: top, center, both or bottom. |
| width | Preferred cell width in twentieths of a point (twips). |
theme elements
| Key | Description |
|---|---|
| color |
Hexadecimal color value: "FF0000", "000000"...
|
other options
| Key | Description |
|---|---|
| customAttributes | Custom attributes and values. |
Example #1
- phpdocx 18.0:
- new action.
