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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





120710 Oct 7,2015 01:22 PM UTC Oct 8,2015 02:06 PM UTC WinForms 1
Tags: XlsIO
Chiara Marzano
Asked On October 7, 2015 01:22 PM UTC

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.\r\nNome 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

Mathu Mohan Vijayakumar [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon