Hi team,
Please let me know how can we fetch the active cell of the worksheet when we draw a chart in the sheet.
Can we get the lower right corner cell as acive cell ?
If not please tell me the alternative approach get the end of the chart in the sheet.
Thanks
@Thilakbabu,
Please try to use Worksheet.getActiveCell() attribute to get active cell in the worksheet. Also, you may use Worksheet.setActiveCell() method to set your desired cell as active cell.
Yes, you may get the lower right corner cell of the chart. You may try to use ChartShape.getLowerRightRow() and ChartShape.getLowerRightColumn() to get the row and column indices of the lower right row and column. Once you have both indexes, you may know the cell name. See the sample code segment for your reference.
e.g.
Sample code:
.........
Chart chart = worksheet.getCharts().get(chartIndex);
shape = chart.getChartShape();
int endRow = shape.getLowerRightRow();
int endColumn = shape.getLowerRightColumn();
String endCell = CellsHelper.cellIndexToName(endRow, endColumn);
......
Hope, this helps a bit.
Thanks @Amjad_Sahi for the reply!