XmlApi - pdx:customizeWordContent

pdx:customizeWordContent

Changes content styles on the fly of documents created from scratch and templates.

Description

Element definition

Attributes and sub-elements

referenceNode

Key Description
target document, style, lastSection.
type * (all, default value), break, chart, endnote (content reference, the whole paragraph is removed), footnote (content reference, the whole paragraph is removed), image, paragraph (also for bookmarks, links and lists), section, shape, table.
contains Contains a text string.
ocurrence Number of ocurrence from 1.
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.

options

Key Description
backgroundColor hexadecimal color: FF0000.
bold If true the text will be shown in bold characters.
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.
caps If true displays text in capital letters.
cellMargin General cell margins for the whole table. 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).
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.
columnWidths An integer or a zero-based array with the widths of each column in twentieths of a point.
depthLevel Depth level.
em Emphasis mark type: none, dot, circle, comma, underDot.
fitText If true fits the text to the size of the cell.
font Font family: 'Arial', Calibri'...
fontSize Font size in points.
gutter Gutter in twips (used for binding).
headingLevel The heading level.
height Given in emus (1cm = 360000 emus).
imageAlign Image alignment: right, center...
indent Left table margin in twentieths of a point (twips).
italic If true displays the text in italics.
lineSpacing
  • 1 corresponds to single line spacing
  • 2 to double line spacing and so long so forth
It admits decimal numbers.
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.
minHeight Minimum height in twentieths of a point.
numberCols Number of columns for the section.
orient Section page orientation (portrait or landscape).
pageBreakBefore If true forces a page break before the paragraph.
position Position value. Positive value for raised and negative value for lowered.
pStyle Word style to be used. Run parseStyles() method to check all available paragraph styles.
rowspan The row span of that particular table cell.
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.
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).
tableAlign Table alignment. Possible values are: center, left or right.
tableStyle Word table style id (you may run parseStyles method to check for the available styles in phpdocx or your particular template).
tableWidth Its possible keys and values are:
  • 'type' (pct, dxa) pct if the value refers to percentage and dxa if the value is given in twentieths of a point (twips).
  • 'value' (int).
type 0 (clear), 1 (inordinate) (default), 2 (numerical) or the name of the created list.
underline Underlines text. Possible values are: single, words, double, dotted, dash and wave.
underlineColor Underlines text with a color: 'FF0000', '000000'...
vAlign Vertical align of text: top, center, both or bottom.
width Given in emus (1cm = 360000 emus).
Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code