Aspose.words for java 在html转docx中怎么将有序列表一二三 转成aspose.words的SIMP_CHIN_NUM_1

<ol style="list-style-type: cjk-ideographic;" data-mce-style="list-style-type: cjk-ideographic;">
    <li>asdas&nbsp;</li>
    <li>asdasd</li>
    <li>asdasd</li>
</ol>

@wzy1027 您可以通过使用如下代码对文档进行后处理来实现此目的:

Document doc = new Document("C:\\Temp\\in.html");

Iterable<Paragraph> paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, true);
for (Paragraph p : paragraphs)
{
    if (!p.isListItem())
        continue;

    if (p.getListFormat().getListLevel().getNumberStyle() == NumberStyle.ARABIC)
        p.getListFormat().getListLevel().setNumberStyle(NumberStyle.SIMP_CHIN_NUM_1);
}

doc.save("C:\\Temp\\out.docx");

如果我有的列表也需要是阿拉伯数字,这样不就全部替换了吗

@wzy1027 是的,代码更改了所有具有阿拉伯编号样式的列表中的编号样式。 我们将考虑在导入 HTML 时支持 cjk-idegraphic` 列表样式类型

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-26446

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

think you,

You made a right decision

1 Like