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

Free Support Forum - aspose.com

How to set chart image backgound transparent?

Hi,
I am using aspose-cells-7.7.1.5.jar. I am trying to set the chart image background to transparent using
ImageOrPrintOptions.setTransparent(true);

But it doensot take effect. Is there any other way to set an image background to transparent.

Thanks & Regards,
Jaspreet

Hi Jaspreet,


Thank you for contacting Aspose support.

Please note, the transparent option is only available for PNG type of images, therefore please set the ImageFormat to PNG before setting the Transparent property to true, and give it a try on your end.

Java

ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setImageFormat(ImageFormat.getPng());
options.setTransparent(true);

In case the problem persists, please provide us your template spreadsheet as well as your complete code snippet for our review.

Hi Raza,

Thanks for the quick feedback.
Well the problem still persists.On converting a chart to image, transparency does not take effect.

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setImageFormat(ImageFormat.getPng());
imgOptions.setOnePagePerSheet(false);
//imgOptions.setHorizontalResolution(150);
//imgOptions.setVerticalResolution(150);
imgOptions.setOnlyArea(true);
// imgOptions.setChartImageType(ImageFormat.getPng());
imgOptions.setQuality(100);
imgOptions.setTransparent(true);

Also setting transparency to true in following scenario gives an invalid image
SheetRender sr = new SheetRender(sheet, imageOrPrintOptions);
sr.toImage(0, outPutFilePath);

Well I am testing this on a very random sample created by me. But still I have attached the same.

Hi Jaspreet,


We are really sorry for the inconvenience caused to you.

It seems to be a bug in the Aspose.Cells for Java API, reason being, when we tried to convert the spreadsheet to PNG with transparent background while using the latest version of Aspose.Cells for Java 8.1.0, the resultant PNG contains black background. We have logged this problem in our bug tracking system under ticket CELLSJAVA-40852 for thorough investigation. Please spare us little time to properly analyze the problem cause, and to provide a fix at earliest. In the meanwhile, we will keep you posted with updates in this regard.

Hi,

Thanks for using Aspose.Cells for Java.

We have fixed this issue.

Please download and try this fix: Aspose.Cells for Java v8.1.0.3 and let us know your feedback.

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


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