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

Free Support Forum - aspose.com

Inserting data in next unpopulated row


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have some code that inserts the contents of a datatable into worksheet object. This works well.

I now need to insert a second datatable. The contents of these datatables vary therefore instead of saying for example:

Insert datatable at A20

I need something like

Insert datatable at the next unpopulated row

Any suggestions appreciated.



After you have inserted/exported a datatable into the worksheet, you need to calculate/find out the last/farthest row which has data in the cells. We recommend you to kindly use:

worksheet.Cells.MaxRow attribute —> to get the farthest row index which has data or style in the cell(s)
worksheet.Cells.MaxDataRow attribute – to get the farthest row index which contains data in the cells.

int nextrow = worksheet.Cells.MaxDataRow +1;