Aspose.Words for Java word转html,word转换后一列表格位置偏移

word转换后一列表格位置偏移.zip (116.2 KB)

代码:

Document document = new Document(sourceFileName);
HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.setUseTargetMachineFonts(false);
options.setUseHighQualityRendering(true);
options.setEncoding(Charset.forName(“UTF-8”));
options.setExportEmbeddedFonts(true);
options.setShowPageBorder(true);
document.acceptAllRevisions();
document.save(targetFileName, options);

@xiangma,

在将 Word DOC 文档转换为 HTML 固定文件格式时,您只需将默认编辑语言设置为 Chinese PRC 即可解决此问题:

LoadOptions loadOptions = new LoadOptions();
loadOptions.getLanguagePreferences().setDefaultEditingLanguage(EditingLanguage.CHINESE_PRC);
Document doc = new Document("C:\\Temp\\231524\\in.doc", loadOptions);
HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.setUseTargetMachineFonts(false);
options.setUseHighQualityRendering(true);
options.setEncoding(Charset.forName("UTF-8"));
options.setExportEmbeddedFonts(true);
options.setShowPageBorder(true);
doc.acceptAllRevisions();
doc.save("C:\\Temp\\231524\\awjava-21.6.html", options);