Skip to content

Commit 85e9144

Browse files
authored
Merge pull request #1329 from eweso/patch-1
Adding setNumId method for ListItem style
2 parents 815bb52 + 91ada21 commit 85e9144

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/PhpWord/Style/ListItem.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ public function getNumId()
139139
return $this->numId;
140140
}
141141

142+
/**
143+
* Set numbering Id. Same numId means same list
144+
* @param mixed $numInt
145+
*/
146+
public function setNumId($numInt)
147+
{
148+
$this->numId = $numInt;
149+
$this->getListTypeStyle();
150+
}
151+
142152
/**
143153
* Get legacy numbering definition
144154
*
@@ -148,7 +158,12 @@ public function getNumId()
148158
private function getListTypeStyle()
149159
{
150160
// Check if legacy style already registered in global Style collection
151-
$numStyle = "PHPWordList{$this->listType}";
161+
$numStyle = 'PHPWordListType' . $this->listType;
162+
163+
if ($this->numId) {
164+
$numStyle .= 'NumId' . $this->numId;
165+
}
166+
152167
if (Style::getStyle($numStyle) !== null) {
153168
$this->setNumStyle($numStyle);
154169

0 commit comments

Comments
 (0)