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

Sheet.UsedRange raise exception: please help us to find why :-)

Good afternoon
We're using DocIo v.13.1 in order to create XLS files.
Sometimes, our programs need to fill data into sheets of an XLS "model".
And sometimes we need to find the first free cell: so we have a Function that performs some checks to find the first free cell.
We're using _sheet.UsedRange method.
This method raise the exception {"Argomento specificato non compreso nell'intervallo.\rNome parametro: firstCol or lastCol"}, when we use it on a certain sheet.
Could you please help us to find the reason of this exception?
Into the attached file you'll find:
- a sample project that performs the operations (_sheet.UsedRange is used in  ValFirstFreeLine function)
- a sample XLS file (sheet COVER is the "wrong" one
Thank you very much
Best regards
Chiara Marzano
Sistemi S.p.A.

Attachment: Sheet.UsedRange_Exception_b6cacee3.zip

1 Reply

MM Mathu Mohan Vijayakumar Syncfusion Team October 8, 2015 02:06 PM UTC

Hi Chiara,

Thank you for using Syncfusion Products.

In your sample we can see that you are assigning the “UsedRangeIncludesFormatting” property to false, which will delete the empty cells even the cells having a formatting. So the used range is null and exception is thrown. We have prepared a simple sample illustrating this behavior along with the below code snippet for your reference.

Code Snippet:


    /// Gets or sets whether used range should include cells with formatting.

    /// 1) if this property is true. The cell is included into UsedRange,

    /// even data is empty (maybe some formatting

    /// changed, maynot be - cell was accessed and record was created).

    /// 2) if this property is false. In this case XlsIO tries to remove empty rows

    /// and columns from all sides to make UsedRange smaller.

    bool UsedRangeIncludesFormatting = true.

Sample Link:

Please let us know if you need any clarifications.

Mathu Mohan V A

Live Chat Icon For mobile
Up arrow icon