Linked Questions

Popular Questions

Aligment of li element in PHPWord

Asked by At

I try to convert HTML to DOCX with PHPWord library (phpoffice/phpword:v0.16)

$html = "<html><head></head>
<body>
<ol>
<li style='text-align: left'>line</li>
<li style='text-align: right'>line</li>
<li style='text-align: right'>line</li>
</ol>
</body>
</html>";

$section = $phpWord->addSection(array('pageNumberingStart' => 1));
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, true, false);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');

Docx file is generated properly, but all text inside <li> elements is aligned to the left: aligned all to the left

Any idea how to align text in docx file, defined in style attribute in HTML? The result should be: aligned to the left and right

Related Questions