We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert word document to html with images

I created a word document with images and I want with Aspose.Word to save it with an html file with images, I tried several ways and I did not do it. Please request help to carry out this process.

I have used the following code (using Aspose.word for JAVA):
… …
Document doc = new Document(fileDirectory + File.separator + nameWordFile);
ByteArrayOutputStream baos1 = new ByteArrayOutputStream();

doc.save(baos1, SaveFormat.HTML);
byte[] byteFileHtml = baos1.toByteArray();
ByteArrayInputStream bais1 = new ByteArrayInputStream(byteFileHtml);

and the “bais1” content does not contain images.

@luis_castro_impuesto

Thanks for your inquiry. Please try following code snippet, hopefully it will help you to resolve the issue. However, if the issue persists then please share your input document as ZIP file here, we will look into it and will guide you accordingly.

....
com.aspose.words.HtmlSaveOptions options= new com.aspose.words.HtmlSaveOptions();
options.setSaveFormat(com.aspose.words.SaveFormat.HTML);
options.setExportImagesAsBase64(true);
options.setExportFontsAsBase64(true);
ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
doc.save(baos1,options);
....