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

Free Support Forum - aspose.com

Missing images when converting Excel to html

I convert the excel file to html, but images are missed in the result html file.

Anyone can help me?
thx
codes and xls file are attached .

thx
B.R

Hi there,


Thank you for sharing the samples.

I have evaluated the presented scenario while using the latest version of Aspose.Cells for Java 17.02.1 (attached) and following piece of code. I am afraid, I am not able to notice the said problem as the image from worksheet “Sales Order” has rendered fine in the resultant HTML (attached in an archive). Could you please give a try to the latest version on your side as well? In case the problem persists, please share the following details.

  • Operating system version & architecture
  • JDK vendor, version & architecture
  • JVM arguments, if any

Java

HtmlSaveOptions options = new HtmlSaveOptions();
options.getImageOptions().setImageFormat(ImageFormat.getPng());
options.setExportImagesAsBase64(true);
options.getImageOptions().setCellAutoFit(true);
options.getImageOptions().setTransparent(true);
options.setExportActiveWorksheetOnly(true);

Workbook book = new Workbook(dir + “so-copy.xls”);
book.getWorksheets().setActiveSheetIndex(1);
book.save(dir + “output.html”, options);

<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”>Great. Thanks a lot for your quick response.

<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> Development details are as below:
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> Aspose: 8.4.2
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> Operation system: Windows 10
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> JVM : 1.8
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”>
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> Thx
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> B.R
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”> Shaoqin.Chen
<span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”>

Hi Shaoqin,


Thank you for sharing the details. I have tried the scenario against Aspose.Cells for Java 8.4.2, and I am still not able to replicate the said issue on my side (please check the attached archive for the resultant HTML) regardless of the fact that I am testing the case on Windows 10 x64 with JDK 1.8.0_111. Please note, there is only one image in the worksheet “Sales Order” as highlighted in the attached snapshot. This image has rendered fine while using v8.4.2 & v17.02.1. Am I missing something? Have you tried the latest version of Aspose.Cells for Java 17.02.0 against this problem?

Hi Babar

Thank you. But I can replicate the same issue with 17.02.0. I attached the result file.
So werid!
Could you help attach your whole codes if possible?
thx

Hi again,


Thank you for the resultant HTML. I can observe that the image is missing in your provided HTML. I am currently not sure what could be causing the different behaviour. Anyway, I am currently in discussion with the product team on this matter, and I will try to find a way to isolate the problem cause. In the meanwhile, could you please execute the following piece of code against latest version of Aspose.Cells for Java 17.02.1 in a new console application by first downloading the input spreadsheet (so-copy.xls) from this thread? Please share the console output as well as the resultant HTML here.

Java

System.out.println(CellsHelper.getVersion());
System.out.println(System.getProperty(“java.version”));

HtmlSaveOptions options = new HtmlSaveOptions();
options.getImageOptions().setImageFormat(ImageFormat.getPng());
options.setExportImagesAsBase64(true);
options.getImageOptions().setCellAutoFit(true);
options.getImageOptions().setTransparent(true);
options.setExportActiveWorksheetOnly(true);

Workbook book = new Workbook(dir + “so-copy.xls”);
book.getWorksheets().setActiveSheetIndex(1);
book.save(dir + CellsHelper.getVersion() + " output.html", options);

Hi again,


Adding more to my previous response, if you are able to get correct results with the code snippet provided above (where I am loading the spreadsheet from file path and saving the result directly on disc) but not with your own code then please share an executable sample application (preferably console) in order to help us replicate the problem.

Hi bara.raza

Thank you. the root cause(missing images) is from my codes.Sorry for that.
I have encountered new issues which needs your professional help.
  • lost some styles in result html file(style loss.jpg)
  • add additional td when column content is beyond of columns’ width (over.jpg)
I have attached some screenshots , Could you help take a look at those.
Thx
Shaoqin chen
B.R

Hi Shaoqin,


Thank you for the confirmation on previously reported problem. Regarding your recent concerns, I have evaluated both mentioned scenarios while using the latest version of Aspose.Cells for Java 17.02.4, and I am able to notice the issue of missing borders in the resultant HTML. I have raised this problem as CELLSJAVA-42204 for further investigation. The other issue (add additional td when column content is beyond of columns’ width) has not been reproduced with latest version so it appears that the problem has already been rectified. Please check the resultant HTML (attached in an archive) and feel free to highlight issues, if any.

Hi babar.raza

I encountered a new issue about xlsx file.
the result file loses colSpan style. this issue is just happened for xlsx file.

Hi Shaoqin,


Thank you for writing back. First of all, I would request you to always post distinct problems in separate threads for easy management of your requests. Regarding your recent concerns, I have evaluated the presented scenario against the latest version of Aspose.Cells for Java 17.02.4 (download link shared in my previous response). I am afraid, I am not able to observe the said issue therefore it seems that the problem has already been addressed. Please give a try to the latest version on your end as well, and share your feedback.
Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix: Aspose.Cells for Java v17.02.8 and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-42204) have been fixed in Aspose.Cells for Java 17.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.