Skip to content

ListItem object doesn't get added to ODText document #2159

@puiuallex

Description

@puiuallex

Describe the Bug

Hello,

If you load a ODText document and try to create another one with createWriter method but pass the loaded document into it, and if the loaded .odt document contains sections with ListItem/ListItemRun elements those are not getting added to the new created document.

Regards,
Alexe

Steps to Reproduce

  1. Create a document and insert a list into it

  2. Load ODText document.

$document = \PhpOffice\PhpWord\IOFactory::load("document-x", 'ODText');

  1. Create a writer, save it and download it.

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($document, 'ODText');
$objWriter->save(storage_path('newDocument.odt'));

return response()->download(storage_path("newDocument.odt"));

Expected Behavior

I was expected that the downloaded document was the same as the loaded one.

Current Behavior

The list is missing from the downloaded document.

Context

Please fill in your environment information:

  • PHP Version: 8.0.10
  • PHPWord Version: ^0.18.2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions