Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changes/1.x/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Enhancements

- Allow setting list style while reading HTML as input

### Bug fixes

- Set writeAttribute return type by [@radarhere](https://github.com/radarhere) fixing [#2204](https://github.com/PHPOffice/PHPWord/issues/2204) in [#2776](https://github.com/PHPOffice/PHPWord/pull/2776)
Expand Down
10 changes: 8 additions & 2 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,15 @@ protected static function parseList($node, $element, &$styles, &$data)
*/
protected static function getListStyle($isOrderedList)
{
$type = $isOrderedList ? 'multilevel' : 'hybridMultilevel';

if (isset(self::$options['LIST_STYLES'][$type])) {
return self::$options['LIST_STYLES'][$type];
}

if ($isOrderedList) {
return [
'type' => 'multilevel',
'type' => $type,
'levels' => [
['format' => NumberFormat::DECIMAL, 'text' => '%1.', 'alignment' => 'left', 'tabPos' => 720, 'left' => 720, 'hanging' => 360],
['format' => NumberFormat::LOWER_LETTER, 'text' => '%2.', 'alignment' => 'left', 'tabPos' => 1440, 'left' => 1440, 'hanging' => 360],
Expand All @@ -626,7 +632,7 @@ protected static function getListStyle($isOrderedList)
}

return [
'type' => 'hybridMultilevel',
'type' => $type,
'levels' => [
['format' => NumberFormat::BULLET, 'text' => '•', 'alignment' => 'left', 'tabPos' => 720, 'left' => 720, 'hanging' => 360, 'font' => 'Symbol', 'hint' => 'default'],
['format' => NumberFormat::BULLET, 'text' => '◦', 'alignment' => 'left', 'tabPos' => 1440, 'left' => 1440, 'hanging' => 360, 'font' => 'Courier New', 'hint' => 'default'],
Expand Down