Hi Aspose team
We are working on saving Word in HTML format using Aspose Word 16.11.0 for cross-platform viewing.
Here is our code for test in Linux environment:
Document doc = new Document(“custom/input/docx/CAT Pusheen Meow base.docx”);
Document pageDoc;
LayoutCollector layoutCollector;
DocumentPageSplitter splitter;
ByteArrayOutputStream output = new ByteArrayOutputStream();
HtmlSaveOptions saveOp = new HtmlSaveOptions();
saveOp.setExportImagesAsBase64(true);
saveOp.setExportTextInputFormFieldAsText(false);
saveOp.setExportTocPageNumbers(true);
saveOp.setExportPageSetup(true);
saveOp.setExportDocumentProperties(true);
saveOp.setExportRelativeFontSize(false);
layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
splitter = new DocumentPageSplitter(layoutCollector);
byte[] outputContent;
String outputPath = “custom/output/docx”;
String blockID = UUID.randomUUID().toString();
for (int page = 1; page <= doc.getPageCount(); page++) {
pageDoc = splitter.getDocumentOfPage(page);
output.reset();
pageDoc.save(output, saveOp);
outputContent = output.toByteArray();
File outputDir = new File(outputPath + “/” + blockID + “/”);
if (!outputDir.exists())
outputDir.mkdir();
IOUtils.write(outputContent, new FileOutputStream(outputPath + “/” + blockID + “/” + page + “.html”));
}
In the result, there several issues of the format.
1.There some rectangles seems to be shorten.
2.Some text blocks are covered by another.
3.Maybe there should be more line breaker to make the text move to the much lower position?
Anyway to improve this? Or is this issue a bug?
Craig