Creates a new Word paragraph style.


Element definition

This element allows the generation of custom paragraph styles that may be later used in combination with, for example, the addText element.



A string with the name of the Word style that we are creating.


If there is a tab and the tabPositions array is not defined the standard tab position (default of 708) will be used.
key Description
bold Bold text: 'on' or 'off'
border Hexadecimal color value: 'FF0000', '000000'...
caps Displays text in capital letters: 'on' or 'off'
color Hexadecimal color value: 'FF0000', '000000'...
contextualSpacing Ignores spacing above and below when using identical styles: 'on' or 'off' (default)
doubleStrikeThrough If true displays text in doubleStrikeThrough.
font Font family: 'Arial', Calibri'...
fontSize Text size in points: 8, 9, 10...
hanging Paragraph hanging in twentieths of a point (twips).
italic Italics: 'on' or 'off'
indentLeft Left margin in twips (twentieths of a point)
indentRight Right margin in twips (twentieths of a point)
indentFirstLine Extra indent for the first line of the paragraph
jc Text alignment. Possible values are: 'center', 'right', 'both', 'distribute'
keepLines Keeps (whenever possible) all the current paragraph lines on the same page: 'on' or 'off' (default)
keepNext Keeps (whenever possible) in the same page the current paragraph with next paragraph: 'on' or 'off' (default)
lineSpacing Separation between lines: 240 (single spacing), 480 (double spacing) and so long so forth.
numberingStyle Adds a custom numbering style.
outlineLvl Heading level (1-9)
pageBreakBefore Forces a page break before the paragraph. 'on' or 'off'
position Position value. Positive value for raised and negative value for lowered.
scaling Scaling value, 100 is the default value.
spacingBottom Bottom padding in twentieths of a point
spacingTop Top padding in twentieths of a point
smallCaps Displays text in small capital letters: 'on' or 'off'
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' (int) given in twentieths of a point.
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): 'on' or 'off'
wordWrap Allows line breaking at character level: 'on' or 'off' (default)
Code samples
#Example 1




The resulting Word document looks like: