Hello,
I have a docx file I’m trying to save as html using Aspose.Words for Java 19.9 library. Saving lasts forever.
Code:
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
Document document = new Document(new FileInputStream(new File("htmlPreviewFile.docx")));
File targetHtmlFile = null;
File imagesDir = null;
try {
imagesDir = Files.createTempDirectory("createHtmlPreviewImages").toFile();
targetHtmlFile = File.createTempFile("createHtmlPreview", "Html");
htmlSaveOptions.setImagesFolder(imagesDir.toURI().getRawPath());
try (OutputStream outputStream = new FileOutputStream(targetHtmlFile)) {
document.save(outputStream, htmlSaveOptions);
} catch (Exception e) {
//
}
} finally {
if (targetHtmlFile != null && targetHtmlFile.exists()) {
FileUtils.forceDelete(targetHtmlFile);
}
}
htmlPreviewFile.zip (508.3 KB)
Can you please check this one?
Knd regards,
Zeljko