Join
Sign in
Search Options
Search Everything
Search Development Tools
Home
Blog
Resources
Forums
About Open XML
More ...
Home
»
Forums
»
Development Tools
»
.Net
»
getting error "File contains corrupted data" when trying to open excel file using OpenXML
Re: getting error "File contains corrupted data" when trying to open excel file using OpenXML
Development Tools
Discussions about working with Open XML using a wide range of development tools
Get this RSS feed
Details
1
Reply
2
Subscribers
Posted
over 2 years ago
Options
Subscribe via RSS
Share this
.Net
getting error "File contains corrupted data" when trying to open excel file using OpenXML
rated by 0 users
This post has
1 Reply |
2
Followers
vikas
40
Posted by
vikas
on
Tue, Jun 29 2010 7:35 AM
rated by 0 users
Post Points: 20
getting error "File contains corrupted data" when trying to open excel file using OpenXML
Hi,
i am having application developed in .Net 2.0 and using OpenXML to import excel file into aplication but getting following exception on this line of code
SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(Path, true);
Can anybody please help me on this as this is bvery much urgent for me.
Following are exception details
--------------------------------- Error message -------
System.IO.FileFormatException: File contains corrupted data.
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream archiveStream)
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.SeekableLoad(ZipIOBlockManager blockManager)
at MS.Internal.IO.Zip.ZipIOBlockManager.LoadEndOfCentralDirectoryBlock()
at MS.Internal.IO.Zip.ZipArchive..ctor(Stream archiveStream, FileMode mode, FileAccess access, Boolean streaming, Boolean ownStream)
at MS.Internal.IO.Zip.ZipArchive.OpenOnFile(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
at System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(String path, Boolean readWriteMode)
at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable, OpenSettings openSettings)
at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable)
at Banking_ImportStatements.ImportOnlineTemplate(String name, Int64 len) in e:\Projects\Siondo ERP\2 Siondo ERP EXECUTION\3 Source Code\SiondoERP\SiondoERPUI\Banking\ImportStatements.aspx.cs:line 1121}
Thanks & Regards,
Vikas Jaigude.
Intergen
2610
Posted by
Intergen
on
Wed, Jul 14 2010 7:25 PM
rated by 0 users
Post Points: 5
Re: getting error "File contains corrupted data" when trying to open excel file using OpenXML
Hi Vikas
Are you sure the xlsx file is in correct OpenXML format?
A simple test is to open it in Office. Next is to validate it using the OpenXML SDK v2.0 Productivity Tool.
To me this looks like the xlsx is not in a valid zip state.. Could you please try renaming the .xlsx file's extension to .zip and then extract this?
Page 1 of 1 (2 items)