Creates a new Word paragraph style.

public void createParagraphStyle(String name, OptionsParagraphStyle options)

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



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


Option Type Description
bold String Bold text: 'on' or 'off'.
border String Hexadecimal color value: "FF0000", "000000"...
caps Boolean Display text in capital letters.
color String Hexadecimal color value: "FF0000", "000000"...
contextualSpacing String Ignore spacing above and below when using identical styles: 'on' or 'off' (default).
doubleStrikeThrough Boolean If true displays text in doubleStrikeThrough.
em String Emphasis mark type: "none", "dot", "circle", "comma", "underDot".
font String Font family: "Arial", "Calibri"...
fontSize Integer Text size in points: 8, 9, 10...
hanging Integer Paragraph hanging in twentieths of a point (twips).
italic Boolean Italics.
indentLeft Integer Left margin in twips (twentieths of a point).
indentRight Integer Right margin in twips (twentieths of a point).
indentFirstLine Integer Extra indent for the first line of the paragraph.
textAlign String Text alignment. Possible values are: "center", "right", "both", "distribute".
keepLines Boolean Keeps (whenever possible) all the current paragraph lines on the same page.
keepNext Boolean Keeps (whenever possible) in the same page the current paragraph with next paragraph.
lineSpacing Integer Separation between lines: 240 (single spacing), 480 (double spacing) and so long so forth.
outlineLvl Integer Heading level (1-9).
pageBreakBefore Boolean Forces a page break before the paragraph.
pStyle String Id of the style this paragraph style is based on.
spacingBottom Integer Bottom padding in twentieths of a point.
scaling Integer Scaling value, 100 is the default value.
smallCaps Boolean Displays text in small capital letters.
spacingTop Integer Top padding in twentieths of a point.
strikeThrough Boolean If true displays text in strikethrough.
tabPositions ArrayList<HashMap<String, String>>
  • "type" can be clear, left (default), center, right, decimal, bar and num.
  • "leader" can be none (default), dot, hyphen, underscore, heavy and middleDot.
  • "position" given in twentieths of a point.
textDirection String Text flow: lrTb, tbRl, btLr, lrTbV, tbRlV, tbLrV.
underline String Underlines text. Possible values are: "single", "words", "double", "dotted", "dash" and "wave".
vanish Boolean Uses a vanish style.
widowControl Boolean 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 Boolean Allows line breaking at character level.
Code samples

Example #1

The resulting Word document looks like:

Example #2

The resulting Word document looks like: