如何使用C#打开一个Excel文档 [英] How to open an excel document using c#
本文介绍了如何使用C#打开一个Excel文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用的打开XML SDK 2.0 来创建一个新的spreadhsheet并保存到用户文件夹。我希望能够保存后自动打开此。该文件是在XLSX格式。
I've used the Open XML SDK 2.0 to create a new spreadhsheet and save to a users folder. i want to be able to open this automatically after saving. The file is in the xlsx format.
我试过
SpreadsheetDocument.Open(fileName, true);
这是不工作的。我想代码,打开文件的任何Excel版本的用户 - 2003年,2007年和2010年(假设:2003将安装兼容性包)
This isn't working at all. I'd like the code to open the file in whatever version of excel the user has - 2003, 2007 and 2010 (Assumption: 2003 will have the compatibility pack installed)
推荐答案
如果Excel中设置为可以使用的Process 类:
If excel is set as the default viewer for xls files on the system you can open the file using Process class:
System.Diagnostics.Process.Start("myFile.xls");
这篇关于如何使用C#打开一个Excel文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文