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

Free Support Forum - aspose.com

How to find out how many rows in excel a chart has occupied?

I want to add more than one chart in a sheet just below each other. How can I know the no. of rows which first chart has occupied so that I can properly set the upperleftrow and upperleftcolumn properly while adding the second chart to the worksheet?


Please go through the API reference guide for the Shape Class. Consider an existing Chart as a shape. You can get the number of Row and Columns that a chart is occupying using the below source code statements. Attached is my input file for your reference.

Workbook book = new Workbook();
Worksheet sheet = book.getWorksheets().getSheet(0);
Shape chart = sheet.getShapes().get(0);

System.out.println("Upper Left Row " + chart.getUpperLeftRow());
System.out.println("Upper Left Column " + chart.getUpperLeftColumn());
System.out.println("Lower Right Row " + chart.getLowerRightRow());
System.out.println("Lower Right Column " + chart.getLowerRightColumn());