Free Support Forum - aspose.com

Missing images in conversion from XLS to HTML

Hi


I am busy evaluating Aspose. When I attempt to convert an XLS file to HTML using…

Workbook workbook = new Workbook(is);
workbook.save(fos,saveFormat);

the images are showing up as broken hyperlinks. How do I get the images to be encoded inline?

Much appreciate

Jamie

Hi,

Thanks for your posting and using Aspose.Cells for Java.

It is actually HTML format limitation. When you will save your HTML file into streams, html images will disappear.

You should save your file into html file not streams. (file output stream). The following code will work fine.

Java


Workbook workbook = new Workbook(is);

workbook.save(“output.html”,saveFormat);

Hi There


I am using the API call you mention. Are the images saved separately in the same location as where the html file is saved? This seems a bit lame to me. Why don’t you just embed the images in the html?

Something like:

<img src=“data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM0AAAD
NCAMAAAAsYgRbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5c
cllPAAAABJQTFRF3NSmzMewPxIG//ncJEJsldTou1jHgAAAARBJREFUeNrs2EEK
gCAQBVDLuv+V20dENbMY831wKz4Y/VHb/5RGQ0NDQ0NDQ0NDQ0NDQ0NDQ
0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0PzMWtyaGhoaGhoaGhoaGhoaGhoxtb0QGho
aGhoaGhoaGhoaGhoaMbRLEvv50VTQ9OTQ5OpyZ01GpM2g0bfmDQaL7S+ofFC6x
v3ZpxJiywakzbvd9r3RWPS9I2+MWk0+kbf0Hih9Y17U0nTHibrDDQ0NDQ0NDQ0
NDQ0NDQ0NTXbRSL/AK72o6GhoaGhoRlL8951vwsNDQ0NDQ1NDc0WyHtDTEhD
Q0NDQ0NTS5MdGhoaGhoaGhoaGhoaGhoaGhoaGhoaGposzSHAAErMwwQ2HwRQ
AAAAAElFTkSuQmCC” alt=“beastie.png” />

Let me know

Jamie

Hi,

Thanks for your posting and using Aspose.Cells.

Aspose.Cells generates HTML file as MS-Excel generates. Therefore it does not embed images in the html file.

Hi,


Please try the latest fix/version: Aspose.Cells for Java v7.4.1.2

Please use this sample code before
Exporting to html.

HtmlSaveOptions hs = new HtmlSaveOptions();

hs.ExportImagesAsBase64 = true;<o:p></o:p>

Thank you.