createCharacterStyle

createCharacterStyle

BASIC / ADVANCED / PREMIUM

Creates a new Word character style.

Description
public void createCharacterStyle(String name, OptionsCharacterStyle options)

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

Parameters

name

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

options

Option Type Description
bold Boolean Bold text.
caps Boolean Display text in capital letters.
characterBorder HashMap<String, String> 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 string Hexadecimal color value: "FF0000", "000000"...
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...
italic Boolean Italic.
position Integer Position value. Positive value for raised and negative value for lowered.
rStyle String Based on style.
strikeThrough Boolean If true displays text in strikethrough.
subscript Boolean If true displays text in subscript.
superscript Boolean If true displays text in superscript.
underline String Underlines text. Possible values are: 'single', 'words', 'double', 'dotted', 'dash' and 'wave'.
vanish Boolean Uses a vanish style.
Code samples

Example #1

The resulting Word document looks like: