Skip to content

Commit 0b99f8f

Browse files
committed
docs: ListItemRun
1 parent e6496bf commit 0b99f8f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/elements.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Legend:
6161
Texts
6262
-----
6363

64-
Text can be added by using ``addText`` and ``addTextRun`` method.
64+
Text can be added by using ``addText`` and ``addTextRun`` methods.
6565
``addText`` is used for creating simple paragraphs that only contain texts with the same style.
6666
``addTextRun`` is used for creating complex paragraphs that contain text with different style (some bold, other
6767
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.
155155
Lists
156156
-----
157157

158-
To add a list item use the function ``addListItem``.
158+
Lists can be added by using ``addListItem`` and ``addListItemRun`` methods.
159+
``addListItem`` is used for creating lists that only contain plain text.
160+
``addListItemRun`` is used for creating complex list items that contains texts
161+
with different style (some bold, other italics, etc) or other elements, e.g.
162+
images or links. The syntaxes are as follow:
159163

160164
Basic usage:
161165

162166
.. code-block:: php
163167
164168
$section->addListItem($text, [$depth], [$fontStyle], [$listStyle], [$paragraphStyle]);
169+
$listItemRun = $section->addListItemRun([$depth], [$listStyle], [$paragraphStyle])
165170
166171
Parameters:
167172

@@ -172,6 +177,8 @@ Parameters:
172177
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem.
173178
- ``$paragraphStyle``. See :ref:`paragraph-style`.
174179

180+
See ``Sample_09_Tables.php`` for more code sample.
181+
175182
Advanced usage:
176183

177184
You can also create your own numbering style by changing the ``$listStyle`` parameter with the name of your numbering style.

samples/Sample_14_ListItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
$listItemRun = $section->addListItemRun();
6565
$listItemRun->addText('List item 1');
6666
$listItemRun->addText(' in bold', array('bold' => true));
67-
$listItemRun = $section->addListItemRun();
67+
$listItemRun = $section->addListItemRun(1, $predefinedMultilevelStyle, $paragraphStyleName);
6868
$listItemRun->addText('List item 2');
6969
$listItemRun->addText(' in italic', array('italic' => true));
7070
$footnote = $listItemRun->addFootnote();

0 commit comments

Comments
 (0)