Inserts (nested) lists into the Word document.

public addList (array $itemList [, mixed $styleType[, array $options]] )

This method allows the insertion of lists (numbered or with bullets) into your Word document.

You may also include nested lists by means of nested arrays of data and fully customize its contents with the use of WordML fragments.

The following style types are always available:

  • Clear: with no bullet or indentation. This is the default value.
  • Unordered: the standard bulleted list of Word or HTML ul tag.
  • Ordered: the standard ordered list of Word or HTML ol tag.

You may also check all the current available lists styles of your phpdocx base template by means of the parseStyles method. This method returns a Word document including the required phpdocx code to insert the lists that are generated within that document.

You may also use the list styles created via the createListStyle method using the name you gave to your custom list.



The array of data with the (nested) list of items. The possible values of each array entry are:

  • A string of text.
  • An inline WordFragment: all block elements are removed prior to insertion.

An array with data and style keys can be used to set override styles.


(mixed), 0 (clear), 1 (inordinate) (default), 2 (numerical) or the name of the created list


The possible keys and values are (required options are shown with yellow background):

Key Type Description
bold bool If true the text will be shown in bold characters.
caps bool If true displays text in capital letters.
color string Hexadecimal color value: 'FF0000', '000000'...
font string Font family: 'Arial', Calibri'...
fontSize int Font size in points.
highlightColor string Highlights the run of text. The available colors are: black, blue, cyan, green, magenta, red, yellow, white, darkBlue, darkCyan, darkGreen, darkMagenta, darkRed, darkYellow, darkGray, lightGray, none.
italic string If true displays the text in italics.
numId positive int Sets a numId value. Useful to generate a continue numbering.
outlineLvl int Heading level (1-9).
pStyle string Paragraph style to be used.
rtl bool Sets to true for right to left languages like Hebrew or Arabic.
smallCaps bool If true displays text in small capital letters.
underline string Underlines text. Possible values are: single, words, double, dotted, dash and wave.
useWordFragmentStyles bool Use WordFragment paragraph styles.
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:

Example #4

The resulting Word document looks like:

Release notes
  • phpdocx 11.0:
    • limited numId values in lists to 32767 to support restrictions from the new MS Word revisions.
  • phpdocx 9.5:
    • supported overwriting styles in level lists.
  • phpdocx 7.5:
    • numId option.
  • phpdocx 6.5:
    • useWordFragmentStyles option.