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

Free Support Forum - aspose.com

Save picture with scale wrong

Workbook wb = new Workbook("C:/bg2.xlsx");
wb.save("C:/1.html");
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getIcon());
wb.save("C:/2.html", o);



pictures are difference size.

Hi,


Thanks for your posting and using Aspose.Cells.

Please use Png image format instead of Icon. It works fine. Here is the code for your reference which generates correct html files.

Java
Workbook wb = new Workbook(dirPath+ “bg2.xlsx”);
wb.save(dirPath+“1.html”);
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getPng());
wb.save(dirPath+“2.html”, o);

In my case, workbook contains some charts.


Use SVG format can prevent charts show fuzzy when zoom in.

So I need aspose.cells generate picture work fine when use SVG format
Workbook wb = new Workbook("C:/bg2.xlsx");
wb.save("C:/1.html");
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getPng());
wb.save("C:/2.html", o);



2.html show the chart wrong.

Hi,


Thanks for your posting and using Aspose.Cells.

You cannot use SVG inside the HTML but you can save your images in the EMF format which does not get distorted on zooming. Please see the following code which is a correct code. However, this code is also not working fine.

So we have logged your issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-42018 - Chart picture is not getting saved when EMF or SVG format is used

Java
Workbook wb = new Workbook(dirPath + “bg2.xlsx”);
wb.save(dirPath + “1.html”);
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setImageFormat(ImageFormat.getEmf());
wb.save(dirPath + “2.html”, o);

I can use SVG inside HTML!


Workbook wb = new Workbook(“C:/bg2.xlsx”);
wb.save(“C:/1.html”);
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getIcon());
wb.save(“C:/2.html”, o);

These codes can generate charts very well, and charts are show in SVG format.
And charts won’t fuzzy when zoom in.

The issue is picture not display well when it had been scaled in excel.
If picture doesn’t scaled in excel, HTML will work fine.

Hi,


Thanks for your posting and using Aspose.Cells.

You are right. Charts work fine when SVG format is used and they don’t get fuzzy. But it cannot happen with your pictures. Because your pictures are in Png format. Just rename your bg2.xlsx to bg2.xlsx.zip and extract its contents via some tool like WinRAR and then check the directory bg2.xlsx\xl\media, you will find there your picture image1.png which I have attached for your reference.

The images of the charts are generated on runtime by Microsoft Excel and Aspose.Cells, therefore you do not find any image of the chart inside the bg2.xlsx.zip. But your pictures are not generated on runtime, they are static pictures. Almost, your pictures are always saved inside your excel file in Png format. So you cannot convert Png format into Svg format. Thanks for your understanding and have a good day.

Downloads.zipWorkbook wb = new Workbook("C:/bg2 (1).xlsx");
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getIcon());
wb.save("C:/3.html", o);


Aspose.Cells generate SVG file for each picture and chart.

Each picture use <image xlink:href="data:image/png; to embeded image in SVG file.</div><div><br></div><div>Aspose.Cells not generate very well when zoom in. And if you zomm in preserve aspect ratio, SVG are well.</div><div><br></div><div>See Downloads.zip, I modified SVG file that generated by Aspose.Cells,</div><div>I change some attribute.</div><div><br></div><div>3.html display similar png format.</div><div><br></div><div>So I hope Aspose.Cells can fix this issue.</div><div><br></div>

In 3.html, there are two pictures.

The left one display wrong, and the right one display OK.

The difference is left one is not scale preserve aspect ratio, and the right one is scale preserve aspect ratio.

Hi,


Thanks for your illustration of this issue and using Aspose.Cells.

We were able to observe this issue as per your description and the screenshot. Picture does not scale well and its SVG file is not correct. When we modify the SVG file as you have described, the output html looks fine like source excel file.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-42022 - Picture does not scale well and its SVG file is not correct

I have also attached the Aspose.Cells generated SVG which is wrong and Manually modified SVG which is correct for a reference. I have also attached the output html generated with the following code.

Java
Workbook wb = new Workbook(dirPath + “s.xlsx”);
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getIcon());
wb.save(dirPath + “3.html”, o);

Hi,

Thanks for using Aspose.Cells.

We have fixed the issue CELLSJAVA-42022 now.

Please download and try the latest fix: Aspose.Cells for Java v16.10.6 and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-42022) have been fixed in this update.


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

Thanks for using Aspose.Cells.

This is to inform you that we have fixed your issue CELLSJAVA-42018 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Here are some tips for you.

1. If you want to export chart to SVG format, please use the following code:
Workbook wb = new Workbook(filePath + "bg2.xlsx");
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setImageFormat(ImageFormat.getIcon());
wb.save(filePath + "1_java.html", o);

2. If you want to export chart to EMF format, please use the following code:
Workbook wb = new Workbook(filePath + "bg2.xlsx");
HtmlSaveOptions o = new HtmlSaveOptions();
ImageOrPrintOptions imgOptions = o.getImageOptions();
imgOptions.setImageFormat(ImageFormat.getEmf());
wb.save(filePath + "2_java.html", o);

Hi,


Please find attached our latest version/fix: Aspose.Cells for Java v16.12.8, it should fix your issue “CELLSJAVA-42018”. Also, please note the tips mentioned in our previous post.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-42018) have been fixed in this update.


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