JSON API - setDocumentDefaultStyles

setDocumentDefaultStyles

PREMIUM TRIAL / ADVANCED

Changes document default styles.

Note

You are reading the JSON API documentation. For the PHP API method please go to setDocumentDefaultStyles.

JSON data
Key Description
backgroundColor Hexadecimal value (FFFF00, CCCCCC, ...).
bidi Sets to true for right to left languages like Hebrew or Arabic.
bold If true the text will be shown in bold characters.
border Available values are:
  • none (default)
  • double
  • dashed
  • outset
  • inset
  • threeDEmboss
  • threeDEngrave
  • ...
borderBottom Overwrites the general border type for the bottom border of the paragraph.
borderLeft Overwrites the general border type for the left border of the paragraph.
borderTop Overwrites the general border type for the top border of the paragraph.
borderRight Overwrites the general border type for the right border of the paragraph.
borderColor Hexadecimal color value: FF0000, 000000...
borderBottomColor Overwrites the general border color for the bottom border of the paragraph.
borderLeftColor Overwrites the general border color for the left border of the paragraph.
borderTopColor Overwrites the general border color for the top border of the paragraph.
borderRightColor Overwrites the general border color for the right border of the paragraph.
borderSpacing Separation between border and text in points.
borderBottomSpacing Overwrites the general border spacing for the bottom border of the paragraph.
borderLeftSpacing Overwrites the general border spacing for the left border of the paragraph.
borderTopSpacing Overwrites the general border spacing for the top border of the paragraph.
borderRightSpacing Overwrites the general border spacing for the right border of the paragraph.
borderWidth Border width in eigths of a point.
borderBottomWidth Overwrites the general border width for the bottom border of the paragraph.
borderLeftWidth Overwrites the general border width for the left border of the paragraph.
borderTopWidth Overwrites the general border width for the top border of the paragraph.
borderRightWidth Overwrites the general border width for the right border of the paragraph.
caps If true displays text in capital letters.
color Hexadecimal color value: "FF0000", "000000"...
contextualSpacing If true ignores spacing above and below the paragraph whenever the neighbouring paragraphs use the same Word style (false by default).
doubleStrikeThrough If true displays text in doubleStrikeThrough.
em Emphasis mark type: 'none', 'dot', 'circle', 'comma', 'underDot'.
firstLineIndent First line indentation in twentieths of a point (twips).
font
string type: font family: "Arial", "Calibri"...

object type:
  • ascii
  • hAnsi
  • eastAsia
  • cs
fontSize Text size in half-points: 8, 9, 10... Multiply by 2 to get the same size as using the fontSize property with addText and other methods.
hanging Paragraph hanging in twentieths of a point (twips).
indentLeft Left margin in twips (twentieths of a point).
indentRight Right margin in twips (twentieths of a point).
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 Separation between lines: 240 (single spacing), 480 (double spacing) and so long so forth.
outlineLvl (headingLevel option alias) The heading level if you want this paragraph to be a heading.
pageBreakBefore If true forces a page break before the paragraph.
pStyle Id of the style this paragraph style is based on (it may be retrieved with the parseStyles method).
rtl Sets to true for right to left languages like Hebrew or Arabic.
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.
strikeThrough If true displays text in strikethrough.
tabPositions Each entry is an associative array with the following keys and values:
  • "type" (string) can be clear, left (default), center, right, decimal, bar and num.
  • "leader" (string) can be none (default), dot, hyphen, underscore, heavy and middleDot.
  • "position" (number) given in twentieths of a point.
If there is a tab and the tabPositions array is not defined the standard tab position (default of 708) will be used.
textAlign Text alignment. Possible values are: left, center, right, both, distribute.
textDirection Text flow: lrTb, tbRl, btLr, lrTbV, tbRlV, tbLrV.
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 Prevents Word from printing the last line of a paragraph by itself at the top of the page (widow) or the first line of a paragraph at the bottom of a page (orphan).
wordWrap Allows line breaking at character level (default value is false).
Code samples

Example #1

Release notes
  • phpdocx 18.0:
    • new action.