Word转html换行问题

换行问题.zip (91.4 KB)

问题一:这里转换后换行了,与原文件不一样了
原始文件


转换后文件

问题二:这里转换后非正常换行,与原文件不一样了
原始文件

转换后文件

@yanke1

  1. 这是预期的行为,因为源文档中有明确的段落分隔符:

2.我无法使用最新的 23.12 版本的 Aspose.Words 和以下代码重现该问题:

Document sourceDoc = new Document("C:\\Temp\\in.docx");
Document destDoc = (Document)sourceDoc.deepClone(false);

for (int i = 0; i < sourceDoc.getPageCount(); i++)
{
    Document page = sourceDoc.extractPages(i, 1);
    // unlink page field
    for (Field f : page.getRange().getFields())
    {
        if (f.getType() == FieldType.FIELD_PAGE)
        {
            f.update();
            f.unlink();
        }
    }
    destDoc.appendDocument(page, ImportFormatMode.USE_DESTINATION_STYLES);
}

destDoc.save("C:\\Temp\\out.html");

另外,请注意要准确地按页面分割文档,Aspose.Words 需要构建文档布局。 为此,需要源文档中使用的字体。 如果字体不可用,Aspose.Words 会替换它们,这可能会导致文档布局不正确和页面检测不正确,从而导致字体规格的差异。 请参阅我们的文档以获取更多信息:
https://docs.aspose.com/words/java/manipulate-and-substitute-truetype-fonts/
https://docs.aspose.com/words/java/specify-truetype-fonts-location/

对于问题二,能发一下,你转换后的html吗

@yanke1 当然,这是我使用上面的代码产生的输出:out.zip (11.2 KB)

你转换出来的html,这里的换行位置看起来是不对的,麻烦看一下是什么原因

@alexey.noskov

@yanke1
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-26384

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.