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

List Items Aren't Represented in HTML #491

Open
mjones517 opened this issue Mar 12, 2015 · 1 comment
Open

List Items Aren't Represented in HTML #491

mjones517 opened this issue Mar 12, 2015 · 1 comment

Comments

@mjones517
Copy link

mjones517 commented Mar 12, 2015

I'm trying to generate documents with list items. I need to create an HTML and a DOCX version of the file.

Here's a simplified version of my code:

     // Pull in document generation library
require_once 'extensions/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();

// Create new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();

// Adding an empty Section to the document...
$section = $phpWord->addSection();

    // Create List
    $section->addText(htmlspecialchars('List Header'), $fontSectionHead);
$section->addListItem(htmlspecialchars('List Item 1'), 0, $fontListItem);
$section->addListItem(htmlspecialchars('List Item 2'), 0, $fontListItem);
$section->addListItem(htmlspecialchars('Second Level List Item 1t'), 1, $fontListItem);

    // Saving the document as OOXML file...
   $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
   $objWriter->save('helloWorld.docx');

   // Saving the document as HTML file...
  $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
  $objWriter->save('helloWorld.html');

I would expect the HTML version to have ul and li tags. Instead each item is listed on a new line with just a paragraph tag. Is this a bug? Or am I missing something that needs to happen to make this work correctly?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 18, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants