createCharacterStyle

createCharacterStyle

BASIC / ADVANCED / PREMIUM

Creates a new Word character style.

Description
public createCharacterStyle ( string $name [, array $styleOptions = array() ])

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.

styleOptions

This is an array including all the available styling options.

Key Type Description
bold string Bold text: 'on' or 'off'.
caps string Display text in capital letters: 'on' or 'off'.
characterBorder array 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 bool If true displays text in doubleStrikeThrough.
em string Emphasis mark type: 'none', 'dot', 'circle', 'comma', 'underDot'
font string Font family: 'Arial', Calibri'...
fontSize int Text size in points: 8, 9, 10...
italic string Italics: 'on' or 'off'.
position int Position value. Positive value for raised and negative value for lowered.
strikeThrough bool If true displays text in strikethrough.
subscript bool If true displays text in subscript.
superscript bool If true displays text in superscript.
underline string Underlines text. Possible values are: 'single', 'words', 'double', 'dotted', 'dash' and 'wave'.
vanish bool Uses a vanish style.
Code samples

Example #1

The resulting Word document looks like: