Free Support Forum - aspose.com

Saving a doc with Images as html in Java

Hi there,

I have problems trying to save a document as html using aspose.words in Java.
I figure that my problem is very related to this one (as I do get the same error message):

http://www.aspose.com/community/forums/permalink/303195/303195/showthread.aspx#303195

My document is based on a .doc template and contains images. I have not dealt with any kind of ImageFolder and I do not know how to do this. (the link provided in the solution above does not seem to work)

I have tried playing around with IImageSavingCallback, but I do not know what I should do with the ImageSavingArgs in order to get this to work. I do understand that I have to specify a folder where the images are to be saved and then pass those on to the generated html somehow but I do not know how.

Any hints or pointers?

I figured it out myself in the meantime.
Instead of bothering with the IImageSavingCallback, I found that I can set the ImageFolder on the options themselves:

String imageFolder = “c:\TestReport\Images\”;

HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setImagesFolder(imageFolder);
doc.save(out, options);

Hi Thierry,


Thanks for your inquiry. It’s great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,