Free Support Forum - aspose.com

Range definition

Hello, I have a question about the API documentation.
How can I define a range e.g BH2:BZ3 if the first column is represented for a byte value?

Cells.CreateRange Method (Int32, Byte, Int32, Int32)

[Visual Basic]
Overloads Public Function CreateRange( _
ByVal firstRow As Integer, _
ByVal firstColumn As Byte, _
ByVal rowNumber As Integer, _
ByVal columnNumber As Integer
_) As Range


Is thera a way to define a range using a string like this: “BH2:BZ3”?

Thank You


Hello

For range BH2:BZ3,

firstRow is 2-1 = 1 (zero based),

rowNumber is 3-2 + 1 = 2,

As B is the 2nd letter, H is the 8th leter and Z is 26th letter, so

firstColumn is 2 * 26 + 8 - 1 = 59

lastColumn is 2 * 26 + 26 - 1 = 77

columnNumber = 77 - 59 + 1 = 19

Finally you can create your range like this:

Cells.CreateRange(1, 59, 2, 19)


We will add a new method to simplify your work as:

Cells.CreateRange(string firstCell, string lastCell)

Thanks for your kindly patience.

Hello,
when you expect to have ready the new method Cells.CreateRange(string firstCell, string lastCell) ?

Meantime, perhaps you need to change the firstColumn Byte value for Integer value because for columns bigger than “KA” the index is bigger than 256.

K is 11th letter, zero based is number 10
then, 10 * 26 = 260 > 256

Thank You.
Alejandro

Dear Alejandro,


Please download the latest fix and replace the installed Aspose.Excel.dll, which adds the new method Cells.CreateRange(string firstCell, string lastCell).

Meantime, perhaps you need to change the firstColumn Byte value for Integer value because for columns bigger than “KA” the index is bigger than 256.

Excel totally has 256 columns so the maximum column is IV. If you try to set a column as KA, Aspose.Excel will throw out exception.


Dear Alejandro,

What do you think about the evaluation?

Do you have any problems about tech, licensing or payment?