diff --git a/docs/elements.rst b/docs/elements.rst index 74b1d56f..9d446b27 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -61,7 +61,7 @@ Legend: Texts ----- -Text can be added by using ``addText`` and ``addTextRun`` method. +Text can be added by using ``addText`` and ``addTextRun`` methods. ``addText`` is used for creating simple paragraphs that only contain texts with the same style. ``addTextRun`` is used for creating complex paragraphs that contain text with different style (some bold, other italics, etc) or other elements, e.g. images or links. The syntaxes are as follow: @@ -155,13 +155,18 @@ method or using the ``pageBreakBefore`` style of paragraph. Lists ----- -To add a list item use the function ``addListItem``. +Lists can be added by using ``addListItem`` and ``addListItemRun`` methods. +``addListItem`` is used for creating lists that only contain plain text. +``addListItemRun`` is used for creating complex list items that contains texts +with different style (some bold, other italics, etc) or other elements, e.g. +images or links. The syntaxes are as follow: Basic usage: .. code-block:: php $section->addListItem($text, [$depth], [$fontStyle], [$listStyle], [$paragraphStyle]); + $listItemRun = $section->addListItemRun([$depth], [$listStyle], [$paragraphStyle]) Parameters: @@ -172,6 +177,8 @@ Parameters: TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem. - ``$paragraphStyle``. See :ref:`paragraph-style`. +See ``Sample_09_Tables.php`` for more code sample. + Advanced usage: You can also create your own numbering style by changing the ``$listStyle`` parameter with the name of your numbering style. diff --git a/samples/Sample_14_ListItem.php b/samples/Sample_14_ListItem.php index 774fd284..f40e9f6f 100644 --- a/samples/Sample_14_ListItem.php +++ b/samples/Sample_14_ListItem.php @@ -64,7 +64,7 @@ $section->addText('List with inline formatting.'); $listItemRun = $section->addListItemRun(); $listItemRun->addText('List item 1'); $listItemRun->addText(' in bold', array('bold' => true)); -$listItemRun = $section->addListItemRun(); +$listItemRun = $section->addListItemRun(1, $predefinedMultilevelStyle, $paragraphStyleName); $listItemRun->addText('List item 2'); $listItemRun->addText(' in italic', array('italic' => true)); $footnote = $listItemRun->addFootnote();