如何在C#中将XLS文件转换为XLSX文件? [英] How to convert XLS file to XLSX file in C# ?

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

问题描述



请任何人请指导我在C#中将.XLS转换为.XLSX格式的代码。





谢谢

Hi,
Can any one kindly please guide me the code for converting .XLS to .XLSX format in C#.


Thanks

推荐答案

没有可公开的代码来转换我所知道的电子表格。但是,我相信您可以使用对象模型打开旧电子表格并使用另存为
There is no publicly available code to convert a spreadsheet that I'm aware of. However, I believe you could use the Object Model to open the old spreadsheet and use Save As


您好。



刚刚详细说明解决方案#1。



所有你需要做的就是用一些命令行参数启动一个进程。



例如:



Hello.

Just elaborating on solution #1.

All you need to do is start a process with a few command line arguments.

For example:

string processFilePath = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Microsoft Office\Office12\excelcnv.exe";
string processArguments = "-oice \"" + fileName + "\" \"" + Path.GetDirectoryName(fileName) + @"\" + Path.GetFileNameWithoutExtension(fileName) + ".xlsx\"";
Process process = new Process();
process.StartInfo.FileName = processFilePath;
process.StartInfo.Arguments = processArguments;
process.Start();







Valery。




Valery.


这个 [ ^ ]可以帮助你。但是,您需要以编程方式使用它。
This[^] could help you. You however need to use this programmatically.


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

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