我尝试使用PHPWord库(phpoffice / phpword:v0.16)将HTML转换为DOCX
$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');
答案 0 :(得分:0)
使用CSS。
li {
float: right;
margin-left:20px;
}