License l = new License();
l.setLicense(“aspose.lic”);
try {
Document doc = null;
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);
if (StringUtil.isNullOrEmpty(password)) {
doc = new Document(path);
} else {
LoadOptions loadOps = new LoadOptions(password);
doc = new Document(path, loadOps);
}
layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
splitter = new DocumentPageSplitter(layoutCollector);
String blockId = UUID.randomUUID().toString();
File outputDir = new File(blockId + “/”);
if (!outputDir.exists())
outputDir.mkdir();
for (int page = 1; page <= doc.getPageCount(); page++) {
System.out.println(“page:” + page);
pageDoc = splitter.getDocumentOfPage(page);
output.reset();
pageDoc.save(output, saveOp);
IOUtils.write(output.toByteArray(), new FileOutputStream(blockId + “/” + page + “.html”));
}
} catch (Exception e) {
}
I have uploaded the origin Word file and the result.
Please check the attachment, and help me solve this issue, thanks!