Skip to content

Commit

Permalink
Fix list item styles
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbrouwers authored Mar 14, 2017
1 parent 00bc15e commit e6f8a23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,16 @@ private static function parseListItem($node, $element, &$styles, $data)

$listItemRun = $element->addListItemRun($data['listdepth'], $styles['list'], $styles['paragraph']);

$fontStyle = $styles['font'];
foreach ($cNodes as $cNode) {
if ($cNode->nodeName == '#text') {
$listItemRun->addText($cNode->nodeValue, $fontStyle);
$listItemRun->addText($cNode->nodeValue, $styles['font']);
} elseif($cNode->nodeName == 'em') {
$fontStyle = $styles['font'];
$fontStyle['italic'] = true;
$listItemRun->addText($cNode->nodeValue, $fontStyle);
}
elseif($cNode->nodeName == 'strong') {
$fontStyle = $styles['font'];
$fontStyle['bold'] = true;
$listItemRun->addText($cNode->nodeValue, $fontStyle);
}
Expand Down

0 comments on commit e6f8a23

Please sign in to comment.