Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with lists enclosed in html headings tags #2392

Open
nepos87 opened this issue Apr 18, 2023 · 0 comments
Open

Error with lists enclosed in html headings tags #2392

nepos87 opened this issue Apr 18, 2023 · 0 comments

Comments

@nepos87
Copy link

nepos87 commented Apr 18, 2023

Describe the Bug

When creating a word file if in the text there is a bulleted list enclosed by an H4 tag or any of the html headings tags passed through the Html::addHtml() function, processing stops and the error is: Cannot add ListItemRun in TextRun.

Steps to Reproduce

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

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$text = '<h4><ul><li>List 1</li><li>List 2</li></ul></h4>';
Html::addHtml($section, $text);

header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="Test"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$xmlWriter = IOFactory::createWriter($phpWord, 'Word2007');
ob_clean();
$xmlWriter->save("php:https://output");

Context

  • PHP Version: 7.4
  • PHPWord Version: 0.18.3
@nepos87 nepos87 changed the title Error list item enclosed in html headings tags Error with lists enclosed in html headings tags Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant