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
close icon

Cannot open excel file

Like below, I faced the exception.
 
--Code here
IWorkbook workbook = excelEngine.Excel.Workbooks.Open(stream, ExcelOpenType.Automatic);
--Exception
The type initializer for 'Syncfusion.Compression.Zip.ZipCrc32' threw an exception.
 
I referenced
 
Core
XlsIO.ClientProfile
XlsIO.Compression.Base
 
for partial-trust and also same as full-trust.
 
Thank you.
 
 

6 Replies

MR Mahajothi R Syncfusion Team June 26, 2012 05:41 AM UTC

Hi Jiwon,

 

Thank you for your interest in Syncfusion product.

 

We are not able to reproduce the issue at our side. We have created the sample and tried to reproduce the issue. Could you please modify the posted sample to reproduce the issue and revert us back the same, which helps us to further investigation on this.

 

Sample : OpenExcelFile.zip

 

We have used the following assemblies with the version 10.2.0.56.

 

Syncfusion.Compression.Base.dll

Syncfusion.Core.dll

Syncfusion.XlsIO.ClientProfile.dll

 

Could you please update us with your input template and the version of our Syncfusion product.

 

Please let us know if you need any clarifications.

 

 

Regards,

Mahajothi R.



JI Jiwon July 3, 2012 05:26 AM UTC

I faced that problem in another platform, Winform.
 
I uploaded test solution, and include Winform project.
If you just debug, you can see the exception as I told you.
 
One more curious thing is deployment.

Syncfusion.Core.dll

Syncfusion.Compression.Base.dll

Syncfusion.XlsIO.Base.dll              should be included.

When I refered to those, my test solution is not accepted.

Your reply was for ASP.NET, I want you to make sure.

 

Thank you.

 


SRTestExcelFileIO_f7c42308.zip


JI Jiwon July 3, 2012 06:02 AM UTC

My team member's computer is working as same chord.
 
One more thing for your help, I attach inner exception.
 
--
   at Syncfusion.Compression.Zip.ZipCrc32.ComputeCrc(Byte[] buffer, Int32 offset, Int32 length, UInt32 startCrc)
   at Syncfusion.Compression.Zip.ZipArchiveItem.CheckCrc(Byte[] arrData)
   at Syncfusion.Compression.Zip.ZipArchiveItem.DecompressDataOrdinary()
   at Syncfusion.Compression.Zip.ZipArchiveItem.DecompressData()
   at Syncfusion.Compression.Zip.ZipArchiveItem.get_DataStream()
   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.ParseContentType()
   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.ParseDocument(List`1& themeColors)
   at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseExcel2007Stream(Stream stream, String password)
   at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseStream(Stream stream, String password, ExcelVersion version, ExcelParseOptions options)
   at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, Stream stream, ExcelParseOptions options, ExcelVersion version)
   at Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, Stream stream, ExcelVersion version, ExcelParseOptions options)
   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelVersion version, ExcelParseOptions options)
   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelOpenType openType, String fileName, ExcelVersion version, ExcelParseOptions
 
 
 


MR Mahajothi R Syncfusion Team July 4, 2012 06:33 AM UTC

Hi Jiwan,

 

Thank you for updating us with test solution. We have executed the updated test sample with our custom input template (.xlsx) file, we are not able to reproduce the issue. The reported exception may occur when trying to open the corrupted input excel file so could you please update us with your input template which will helps us to further investigate on this.

 

Deployment:

Your test sample (SRTestWinForm) created with the target version of .NET Framework Client Profile so it do not accept “Syncfusion.XlsIO.Base.dll” assembly. To add “Syncfusion.XlsIO.Base.dll” assembly need to change the project Target Framework.

 

Please let us know if you require any further clarifications.

 

Regards,

Mahajothi R.



BI Bijal October 30, 2012 12:19 PM UTC

Hi Mahajothi,

The sample code shared works perfectly to open .xlsx file.

But when in the same code, if I replace it to open my .xlsx, it fails to open. 

//create object for excel engine

ExcelEngine excelEngine = new ExcelEngine();

//Read input file

//Stream strm = File.OpenRead(@"C:\Users\bmandv1\Exprt\JIRA-3163-CSVtoExcel\OpenExcelFile1960395822\OpenExcelFile\InputFile\NorthwindTemplate.xlsx");

Stream strm = File.OpenRead(@"C:\Users\bmandv1\ExcelTemplate.xlsx");

//open excel workbook

IWorkbook book = excelEngine.Excel.Workbooks.Open(strm, ExcelOpenType.Automatic);

//close the workbook object

book.Close();

 

can you kindly help me with what is the issue with my .xlsx, not allowing to open.

I've attached my .xlsx file for your refernce.

 

Thanks

-Bijal



mytemplate_3_7993f9b3.zip


MR Mahajothi R Syncfusion Team October 31, 2012 10:32 AM UTC

Hi Jiwon,

Thank you for updating us with input template. The issue mentioned here is suspected to be a defect. Please create a new incident regarding the issue mentioned in Forum 104151 so that we can proceed further on this.

 

Please let us know if you require any further clarifications.

 

Regards,

Mahajothi.


Loader.
Live Chat Icon For mobile
Up arrow icon