X - why Offset of a rectange range is a cell?
7 Replies
1 reply marked as answer
KK
Konduru Keerthi Konduru Ravichandra Raju
Syncfusion Team
July 6, 2020 09:47 AM UTC
Hi Khanh Dang,
Greetings from Syncfusion.
We are sorry that we are unable to understand your query and request you to help us by explaining it in detail.
Regards,
Keerthi.
TG
The GridLock
July 6, 2020 05:32 PM UTC
Hi Keerthi,
I mean: why Gworksheet.Range("E3:E15).Offset(0, 1).Address -> return: F3.
did i miss something?
More question: Is there a way for me to check if a string is valid address for Irange , eg "a1::a2" will return an error (must "a1:a2") without trycast?
KK
Konduru Keerthi Konduru Ravichandra Raju
Syncfusion Team
July 7, 2020 11:32 AM UTC
Hi Khanh Dang,
Thanks for sharing the details about query.
Please find the response below.
|
Query |
Response |
|
why Gworksheet.Range("E3:E15).Offset(0, 1).Address -> return: F3. |
The Offset method returns the cell which is shifted by the specified number of rows and columns.
Example:
string address1 = worksheet.Range["E3:E15"].Offset(0, -1).Address; //returns D3
string address2 = worksheet.Range["E3:E15"].Offset(0, 0).Address; //returns E3
string address3 = worksheet.Range["E3:E15"].Offset(0, 1).Address; //returns F3
Please look into following link to know more about Offset method.
|
|
Is there a way for me to check if a string is valid address for Irange , eg "a1::a2" will return an error (must "a1:a2") without trycast? |
When an invalid address is given in IRange, Syncfusion XlsIO throws Argument Exception. |
Regards,
Keerthi.
TG
The GridLock
July 7, 2020 12:15 PM UTC
Hi Keerthi ,

I think it should be rectangles range would be more reasonable, if so this word should be changed "range" to "cell"
KK
Konduru Keerthi Konduru Ravichandra Raju
Syncfusion Team
July 8, 2020 02:58 PM UTC
Hi Khanh Dang,
Thanks for the update.
Syncfusion XlsIO considers even a single cell as range and it is returned as IRange. We will modify the description of the method as “Returns an IRange object that represents a range or cell that is offset from the specified range or cell”.
Kindly let us know if you need any further assistance.
Regards,
Keerthi.
Marked as answer
MJ
Mohit Joshi
January 6, 2022 12:40 PM UTC
This is affecting us as well. When Offset is used on a square range (e.g. a Range with address A1:A5), the function returns a single cell and not a range of the same size of the original range. So if I use sheet.Range["A1:A5"].Offset(0,1) it returns B1 instead of B1:B5.
KK
Konduru Keerthi Konduru Ravichandra Raju
Syncfusion Team
January 7, 2022 09:01 AM UTC
Hi Mohit,
The Offset method returns an IRange object that represents a range or cell that is offset from the specified range or cell. This is the behavior of the Offset method. As promised earlier, we have modified the description of this Offset method in our release version 18.3.0.35.
Kindly let us know if you need any further assistance.
Regards,
Ramya.
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
- Marked answer
-
TG The GridLock
- Jul 5, 2020 11:04 AM UTC
- Jan 7, 2022 09:01 AM UTC