License license=new License();
license.setLicense(MyDir+"Aspose.Total.Java.lic");
Document wordDocument = new Document(MyDir + "1.doc");
wordDocument.acceptAllRevisions();
com.aspose.words.ImageSaveOptions imgSaveOptions = new com.aspose.words.ImageSaveOptions(
com.aspose.words.SaveFormat.JPEG);
imgSaveOptions.setPrettyFormat(true);
imgSaveOptions.setUseHighQualityRendering(false);
com.aspose.words.HtmlFixedSaveOptions htmlFixedSaveOptions = new com.aspose.words.HtmlFixedSaveOptions();
htmlFixedSaveOptions.setPrettyFormat(true);
htmlFixedSaveOptions.setExportEmbeddedCss(true);
htmlFixedSaveOptions.setExportEmbeddedFonts(true);
htmlFixedSaveOptions.setExportEmbeddedImages(true);
htmlFixedSaveOptions.setExportEmbeddedSvg(true);
htmlFixedSaveOptions.setWarningCallback(new com.aspose.words.IWarningCallback() {
@Override
public void warning(com.aspose.words.WarningInfo warningInfo) {
System.out.println(warningInfo.getDescription());
}
});
for (Field field : wordDocument.getRange().getFields()) {
if (field.getType() == FieldType.FIELD_HYPERLINK) {
FieldHyperlink hyperlink = (FieldHyperlink) field;
hyperlink.setTarget("_blank");
}
}
htmlFixedSaveOptions.setPageIndex(0);
htmlFixedSaveOptions.setPageCount(1);
wordDocument.save(MyDir + "Out.html", htmlFixedSaveOptions);
int pageCount = wordDocument.getPageCount();
for (int i = 0; i < pageCount; i++) {
htmlFixedSaveOptions.setPageIndex(i);
htmlFixedSaveOptions.setPageCount(1);
wordDocument.save(MyDir + "Out\\Out" + (i + 1) + "-svg.html", htmlFixedSaveOptions);
imgSaveOptions.setPageIndex(i);
imgSaveOptions.setPageCount(1);
}