Creates a custom list style to use it in combination with the addList and embedHTML methods.

public createListStyle ( string $name [, array $options[, array $listOverrideOptions]] )

This method allows to generate custom list styles that can be used in combination with the addList and embedHTML methods.

If you want the embedded HTML code to use the generated list style, this has to have the same name as the corresponding CSS class for the UL tag. Do not forget to set the option 'customListStyles' to true in your call to embedHTML.



A string with the name of the list you are creating. If used in combination with the embedHTML or replaceTemplateVariableByHTML methods the name given to the new custom list has to coincide with the list style name that you want to override.


The options array includes an array for each list level that you wish to customize.

Key Type Description
type string
  • none
  • bullet
  • decimal
  • upperRoman
  • lowerRoman
  • upperLetter
  • lowerLetter
  • ordinal
  • cardinalText
  • ordinalText
align string 'left', 'center', 'right'.
bold bool If true use bold characters.
color string Hexadecimal color value: 'FF0000', '000000'...
font string Font family. This allows the customization of bullets.
fontSize int Font size in points.
format string The default one is '%1.' for first level, '%2' for second level and so long so forth.
hanging int The extra space for the numbering, should be big enough to accommodate it, the default is 360.
image array Use an image as bullets.
  • src => (string) image path
  • height => (int) using pt
  • width => (width) using pt
italic string If true use italics.
left int The left indent. The default value is 720 times the list level.
numberingStyle string Numbering style.
position int Position value.
start int Start value. The default value is 1.
suff string Level suffix: tab, space or nothing.
typeCustom string Custom number format: '001, 002, 003, ...'... Requires setting the type option (decimal as default).
underline string Underlines. Possible values are: single, words, double, dotted, dash and wave.


Array with the different styling options to override.

Key Type Description
listOptions array Same options than $options.
name string The name to give to the created override.

Image does not exists.

Image format is not supported.

Code samples

Example #1

The resulting Word document looks like:

Example #2

The resulting Word document looks like:

Example #3

The resulting Word document looks like:

Release notes
  • phpdocx 13.0:
    • typeCustom option.
  • phpdocx 11.0:
    • images as bullets (image option).
    • suff option.
  • phpdocx 9.5:
    • supported overwriting styles in level lists.
  • phpdocx 9.0:
    • align and position options.
  • phpdocx 7.5:
    • start option.