Does anyone knows how to make the chart body to be transparent?


I’d like to save a chart to SVG file but need it’s body to be transparent (in below chart, I need the white part to be transparent):
图片.png (5.0 KB)

I use ImageOrPrintOptions.setTransparent(true) method but it seems doesn’t work.

What shall I do?


Based on the image you provided, we have created a sample file. You can refer to the following sample code to achieve the goal. Please refer to the attachment. (23.1 KB)

The sample code as follows:

Workbook wb = new Workbook(filePath + "sample.xlsx");
Chart chart = wb.Worksheets[0].Charts[0];
chart.ChartArea.Area.FillFormat.FillType = FillType.None;
chart.ToImage(filePath + "out_net.svg", ImageType.Svg);
wb.Save(filePath + "out_net.xlsx");

Hope helps a bit.

It works well, thanks very much John!

Thank you for your feedback. You are welcome. If you have any questions, please feel free to contact us.