Hello,
It is possible to get MaxDataRow and MaxDataColumn for a range ?
We know that those properties are available for a worksheet but we don’t find similar properties for a range.
Best regards,
Adriana Minea
Junior Software Developer
IBM Romania
<br>
Hi,
Thanks for your query.
Well, you may easily calculate it, see the sample code below for your reference:
e.g
Sample code:
Workbook workbook = new Workbook(“e:\test2\Book1.xlsx”);
Worksheet _oAsposeWorksheet = workbook.Worksheets[0];
Range range = workbook.Worksheets.GetRangeByName(“MyRange1”);
int maxCol=0;
int maxRow=0;
maxCol = range.FirstColumn + range.ColumnCount - 1;
maxRow = range.FirstRow + range.RowCount - 1;
…
Hope, this helps a bit.
Thank you.
Hi,
Thanks for your answer, but I want to know if there are similar properties for a range which return the last column or row which has content.
Best regards,
Adriana Minea
Software Developer
IBM Romania
Hi,
No, I am afraid, there is no such attributes in Range object, so you have to use some workaround (e.g as per my suggested sample code) to accomplish the task.
Thank you.