We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

IRange - writes to cells outside my range

I have created a range from a sheet like this

IRange myRange = m_sheet.Range[2, 2, 42, 12]

to me this is row col 2,2 to row col 44,12

I pass this range to a method and the method goes

private void writeToRange(IRange writeHere)
{
curRow = 1
curCol = 1
writeHere[curRow, curCol].Text = value
}

Even tho my the address of my range is Sheet1'!B2:L43
the value is written to A1

Is this expected behavior. I expected it to write the value to B2


3 Replies

GM Geetha M Syncfusion Team December 12, 2008 05:29 AM UTC

Hi Kelley,

Thank you for your interest in Syncfusion products.

I see that you are using writeHere[curRow, curCol] which means writeHere[1, 1] (as curRow=1 and curCol=1). So the value is written in A1. If you need to write in B2, please use the below code snippets:

writeHere[2, 2].Text = value;

Please let me know if you have any questions.

Regards,
Geetha



AD Administrator Syncfusion Team December 12, 2008 12:03 PM UTC

Yes I agree that is what I need to do. What I don't understand is why.

What is the point of getting a range on the sheet if when you right to the range you are actually writing to absolute address of the sheet?

This implies to me that I should not be using IRange, I should just talk directly to the sheet.





>Hi Kelley,

Thank you for your interest in Syncfusion products.

I see that you are using writeHere[curRow, curCol] which means writeHere[1, 1] (as curRow=1 and curCol=1). So the value is written in A1. If you need to write in B2, please use the below code snippets:

writeHere[2, 2].Text = value;

Please let me know if you have any questions.

Regards,
Geetha





BP Bhuvaneswari P Syncfusion Team December 16, 2008 01:22 PM UTC

Hi Kelley,

Actually it should work as you expected but currently this is the behavior of XlsIO and already we have logged feature request (When selecting a cell inside a range of cells, it doesn’t consider that range. It consider as a whole sheet rather than a given range.) regarding this and will update the timeline within two days.

Please let me know if you have any concerns.

Best Regards,
Bhuvana



Loader.
Live Chat Icon For mobile
Up arrow icon