如何在C#中以编程方式将xlsx文件转换为2003 xls文件? [英] How to convert xlsx files into 2003 xls files programatically in C#?

查看:55
本文介绍了如何在C#中以编程方式将xlsx文件转换为2003 xls文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 ExcelPackage ,它是一种比Excel Interop API更好的库,可用于以编程方式创建和维护卓越的Excel工作表,但它们是在.xlsx中生成的.大多数将看到这些文件的人都只安装了Office 2003,因此我需要用C#代码将最终结果转换为.xls文件.

I've found ExcelPackage, a better library than Excel Interop API to create and mantain programatically excel sheets, but they are generated in .xlsx. Most of people that will see the files have only office 2003 installed, so I need to convert, in my C# code, the final result into a .xls file.

您知道用C#代码执行此操作的任何方法吗?

Do you know any way to do it in C# code?

** 更新我正在尝试使用SaveAs方法,但是它不起作用,它什么也没做,或者返回错误0x800A03EC.

推荐答案

我怀疑这不是一个流行的答案,但是我不认为将文件从.xlsx转换为.xlsx是可取的.暗示没有必要,但是不幸的是,这太笼统了.

I suspect this won't be a popular answer, but I don't believe that its desirable to convert the files to .xls from .xlsx (I was going to suggest that it wasn't necessary, but, unfortunately, that's a generalisation too far).

可以免费下载"Microsoft Office兼容包",并为Office XP和Office 2003添加了对新格式的支持-因此,至少在一般情况下,要说服用户使系统达到规范,这要好得多.而不是让自己陷入不得不处理Office互操作的问题(这基本上会导致您以及您的用户非常痛苦).同样,我认为Open Office 3支持新格式.

The "Microsoft Office Compatibility Pack" is free to download and adds support for the new formats to Office XP and Office 2003 - far better therefore, at least in the general instance, to persuade your users to bring their systems up to spec than to mire yourself in having to deal with office interop (which is basically going to cause you, and quite possibly your users, a lot of pain). Similarly I believe there is support for the new formats in Open Office 3.

我确实很欣赏在某些情况下不允许人们在系统中添加此功能,但是在大多数情况下,如上添加上述工具将使人们的生活更加轻松,因为这将减少使用Office 2007和Microsoft Office 2007的人之间的摩擦.使用较旧版本的用户.

I do appreciate that there are circumstances where people will not be allowed to add this capability to their system but for the most part adding the tools as above will make people's lives easier since it will reduce the friction between those using Office 2007 and those using older versions.

这篇关于如何在C#中以编程方式将xlsx文件转换为2003 xls文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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