Please add this essential property to Cell


#1

End Property

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

Syntax

expression.End(Direction)

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.


#2

Hi Harrison,

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


#3

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


#4

Hi Harrison,

I will add this feature in next week.