无法使用openxml读取.xls(Excel文件2003-2007) [英] Not able to read .xls (Excel file 2003 -2007) using openxml

查看:196
本文介绍了无法使用openxml读取.xls(Excel文件2003-2007)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Hi All,

Hi All,



我有一个Windows窗体应用程序,它从 读取excel并放入它位于 共享文件夹中。

I have a windows forms application which reads the excel from  and put it in  shared folder.


此后用户可以查看共享文件夹中的所有文件并下载特定文件。

After this users can view all the file inside the shared folder and download the particular file.



但是当我上传和下载xlsx文件时它工作正常,但是当我尝试阅读或写一个.xls文件时。

But when I upload and download the xlsx file it working fine , but when I try to read or  write a .xls file.


抛出以下错误。

Its throwing the below error.


我可以在论坛中看到很多帖子,但他们建议只使用.xlsx文件,但我想使用.xls文件。需要做什么。

I can see lot of posts in forum, but they are suggesting to use only .xlsx file , but I want to use .xls file .what needs to be done.


是否有人遇到此问题,请告诉我修复的内容

Is anybody faced this issue, please let me know what is the fix


谢谢







WindowsBase.dll中出现未处理的'System.IO.FileFormatException'类型异常

An unhandled exception of type 'System.IO.FileFormatException' occurred in WindowsBase.dll



{"文件包含损坏的数据。"

{"File contains corrupted data."


文件包含损坏的数据。

File contains corrupted data.


推荐答案

* .xlsx文件是实际上已经压缩成* .zip格式的XML文件。但是,* .xls文件是早期的Excel数据文件,它们以Microsoft专有的格式存储。您不能使用OpenXML来读取它们。

*.xlsx files are actually XML files that have been zipped into the *.zip format. However, *.xls files are the earlier Excel data files that are stored in a format proprietary to Microsoft. You cannot use OpenXML to read them.

但是,您可以使用Excel XX.X对象库使用COM读取* .xls文件。

However, you can use the Excel XX.X Object Library to read *.xls files using COM.

在C#中读取Excel文件


这篇关于无法使用openxml读取.xls(Excel文件2003-2007)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆