Hi,
Thanks for the template file.
I have evaluated your issue a bit using your newly attached file. I found your template file has some external links/reference and MS Excel tried to connect updated data from the external sources, I got some error message boxes in MS Excel. Also and more importantly, some worksheets are hidden, so when you use the following line of code, you won’t get the underlying sheet, it would get the worksheet (whether hidden or visible) at zero indexed position in any case:
e.g
Sample code:
…
ShapeCollection shapes = excelDocument.getWorksheets().get(0).getShapes();
So, you need to change the line of code a bit, kindly access the worksheet via its name rather than indexed position, see the following sample code that works fine with our latest version/fix: v8.8.0.3 (attached), it renders the image fine.
e.g
Sample code:
Workbook excelDocument = new Workbook(“ImageNe2.xlsm”);
ImageOrPrintOptions imageOrPrintOptions = new ImageOrPrintOptions();
imageOrPrintOptions.setImageFormat(ImageFormat.getPng());
imageOrPrintOptions.setOnePagePerSheet(true);
ShapeCollection shapes = excelDocument.getWorksheets().get(“1.1 Antenna System (RF)”).getShapes();
for(int i=0;i<shapes.getCount();i++)
{
Shape shape = shapes.get(i);
if(shape.getName().equals(“Group 1299”))
{
shape.toImage(“f:/files/output1_new2” + i + “.png”,imageOrPrintOptions);
}
}
Let us know if you still have any issue.
Thank you.