Skip to content

Nested list with text before and after list #2853

@pjotrvdh

Description

@pjotrvdh

Describe the bug and add attachments

When you have a list with a nested list with text before and after the nested list, the created result is that the before and after text is merged together before the nested list

Image

Expected behavior

I expect the before and after to be on the correct places

Image

Steps to reproduce

<?php __DIR__.'/vendor/autoload.php'

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();

$html = '<ul><li>Item 1</li><li><p>play</p><ul><li>tic</li><li>tac</li><li>toe</li></ul><p>with friends</p></li><li>item 3</li></ul>';

\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, preserveWhiteSpace: false);

$writer = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord);
$writer->save('./example ('.date('Y-m-d H-i-s').').docx');

PHPWord version(s) where the bug happened

1.4.0

PHP version(s) where the bug happened

8.4

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions