We’re trying to render an SVG of a table (ListObject) using the following code.
PageSetup setup = sheet.getPageSetup();
setup.setPrintArea(tableRange.getAddress());
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setOnePagePerSheet(true);
options.setImageType(ImageType.SVG);
SheetRender sr = new SheetRender(sheet, options);
sr.toImage(0, "table.svg");
This works well but the problem is that the table’s cells in the generated SVG are transparent unless a cell colour is specified in the excel file. If we make the image type a PNG however, the cells are white in the image and not transparent exactly as we want. We can also see that there is a setTransparency(boolean) function for the ImageOrPrintOptions, but this only works with PNGs and it is false by default anyways.
Is there a way to make it work for SVG as well?
Here is an example of what happens when we try to insert the SVG into a PPT file. Since it is transparent, you can see Powerpoint’s “Click to add Title” text behind the table as it overlaps making the text hard to read too.
Screen Shot 2023-07-31 at 4.55.00 PM.png (642.7 KB)