Hi Aspose team
We are working on saving Word files in HTML format for cross-platform viewing with Aspose Word 15.0.3.
Here is our code for conversion test:
Document doc = new Document(“custom/input/docx/HAWAY_Improvement.2.doc”);
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 this Word file, there is a image in page header on the left of entire page.
However this image is not shown correctly in the result.
I have uploaded a comparison image , the Word file, and the result.
Please help us figure it out what’s going on in this scenario, thank you
Craig