I'm new to aspose cells. I've a template excel file that has a simple Data Table (with a header row and one empty row) and a bar chart (with the data table configured as source).
With aspose cells version 8.1.1. i'm trying to read the excel file, get the table object and insert data into it.
My goal here is to insert data into the table and have the chart refreshed automatically.
This is how i'm taking table object from excel
Workbook workbook = new Workbook(new TestReportsProcessor().getClass().getResourceAsStream("/ChartRefreshTest.xlsx"));
Worksheet worksheet = workbook.getWorksheets().get("Sheet1");
ListObjectCollection listObjectCollection = worksheet.getListObjects();
ListObject table = listObjectCollection.get(0);
But i don't see any method in the ListObject that has option to add/insert row into the table.
Option i have tried : I could get the cell position and insert data into cells manually by getting table start and end rows & column positions. But, when i insert data that way, the data outside the table's preset end position is not inserted as part of the table. i.e. The table is not expanding as i insert rows.
Could you please help?
you can insert records into table object.when all records done, you should update your table's range.
in aspose ListObject object, there is one method:
public void Resize(int startRow, int startColumn, int endRow, int endColumn, bool hasHeaders);
which will udpate your table's orinal range to new one.