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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Zip exception.Unable to read value at the specified position - end of stream was reached.

Thread ID:

Created:

Updated:

Platform:

Replies:

104099 Jun 21,2012 09:52 AM UTC Jun 22,2012 05:06 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Gurpreet
Asked On June 21, 2012 09:52 AM UTC

I have file input control and it allows user to upload xlsx files. I have to validate the content of file as in how many records the file does contains.
When i am trying to read the file using syncfusion xlsio lib.. it show the error message "Zip exception.Unable to read value at the specified position - end of stream was reached."
My code lines are below :

   using (Stream fileStream = file.InputStream)
    {

                    ExcelEngine engine = new ExcelEngine();
                   var wb= engine.Excel.Workbooks.Open(fileStream, ExcelOpenType.Automatic, ExcelParseOptions.Default);
                    var count = wb.ActiveSheet.Rows.Count();
}

Please help, if anybody has solution for this.

Mahajothi R [Syncfusion]
Replied On June 22, 2012 05:06 AM UTC

Hi Gurpreet,

 

Thank you for your interest in Syncfusion products.

 

We are not able to reproduce the reported exception at our side. We have created test sample and placed in the following link for your reference. Could you please update us with your input template and modified test sample, which will helps us to further investigate on this.

 

Sample : ZipException.zip

 

The reported exception may occur due to stream end position. Please try the below code.

 

Code snippet [C#]:

 

using (Stream fileStream = file.InputStream)

{

     ExcelEngine engine = new ExcelEngine();

     // set the stream position to zero

     fileStream.Position = 0;

     var wb = engine.Excel.Workbooks.Open(fileStream, ExcelOpenType.Automatic, ExcelParseOptions.Default);

     var count = wb.ActiveSheet.Rows.Count();

}

 

 

Please let us know if you need any clarifications.

 

 

Regards,

Mahajothi R.


CONFIRMATION

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.

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

;