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

Free Support Forum - aspose.com

Please add this essential property to Cell

End Property

Returns a Cell object that represents the cell at the end of the region that contains the source range. Read-only.



expression Required. An expression that returns a Cell object.

Direction Required Long. The direction in which to move. Can be one of the following XlDirection constants: xlToLeft, xlToRight, xlUp, or xlDown.

Hi Harrison,

Could you elaborate your need? Why you need this property? That will help us design this feature. Thanks.

I use my MS Excel designer workbook as a template so the users can modify a table on it. Users can add rows, columns to that table by using the traditional MS Excel. Data in that table will be used for other purposes. In short, number of rows and columns of that table are unknown. Therefore in the function ExportDataTable of Aspose.Excel, MaxRows and MaxColumns are unknown.

The End property would really help to determine those unknown parameters. Here is my workaround way in VB:

Public Enum xlDirection
End Enum

Public Function CellEnd(ByRef Worksheet As Worksheet, ByRef Cell As Aspose.Excel.Cell, ByVal xlDirection As xlDirection) As Aspose.Excel.Cell

Dim rn As Integer = Cell.Row
Dim cn As Integer = Cell.Column

With Worksheet
Select Case xlDirection
Case xlDirection.xlDown
Do While Worksheet.Cells(rn, CByte(cn)).StringValue <> “” AndAlso rn < 65535
rn += 1
Case xlDirection.xlUp
Do While Worksheet.Cells(rn, CByte(cn)).StringValue <> “” AndAlso rn > -1
rn -= 1
Case xlDirection.xlToLeft
Do While Worksheet.Cells(rn, CByte(cn)).StringValue <> “” AndAlso cn > -1
cn -= 1
Case xlDirection.xlToRight
Do While Worksheet.Cells(rn, CByte(cn)).StringValue <> “” AndAlso cn < 256
cn += 1
End Select
Return .Cells(rn, CByte(cn))
End With
End Function

Hi Harrison,

I will add this feature in next week.

Aspose.Cells has replaced the old product Aspose.Excel which is no more available now. This new product contains lot of advance features supported by the recent versions of MS Excel and is far better in terms of performance and stability. It also supports exporting data from worksheets as demonstrated in the following sample code:

// Instantiating a Workbook object
Workbook workbook = new Workbook(filePath);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Exporting the contents of 7 rows and 2 columns starting from 1st cell to DataTable
DataTable dataTable = worksheet.Cells.ExportDataTable(0, 0, 11, 2, true);

foreach (DataRow r in dataTable.Rows)
    foreach (DataColumn c in dataTable.Columns)
        Double value = r.Field<Double>(c);
        Console.Write(value + "    ");

More details about this feature are available here:
Export Data from Worksheet

Latest version of this product is available here:
Aspose.Cells for .NET (Latest Version)

Complete working solution demonstrating a vast range of features is available here.