如何通过按钮单击c#表单打开Excel应用程序(excel.exe) [英] how to open the Excel Application (excel.exe) by button click on c# form

查看:408
本文介绍了如何通过按钮单击c#表单打开Excel应用程序(excel.exe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i想要通过按钮点击c#表单打开Excel应用程序(excel.exe)

i我是c#(.net)的新人请帮我这个



谢谢



-Tushar

hi all,

i want to Open the Excel Application (excel.exe) by button click on c# form,
i am new in c# (.net) pls help me on this

thank you

-Tushar

推荐答案

例如, System.Diagnostics.Start(excel.exe,some_Excel_file.xlsx); 但为什么呢? Excel可能会或许多不会安装在目标计算机上;您将无法控制用户的进一步操作...考虑更好的事情1)根本不使用Excel(大多数情况下是最佳选择),2)让用户保存Excel文件并做任何用户想要的事情(我假设用户最好不要打开Excel)。

如果要生成Excel文件,可以使用Open XML SDK。请参阅我之前的回答:如何从MS Visual Studio 2010中的添加参考添加microsoft excel 15.0对象库 [ ^ ]。



-SA
For example, System.Diagnostics.Start("excel.exe", "some_Excel_file.xlsx"); but why? Excel may or many not be installed on the target machine; you won't have any control over further action of the user… Consider something better 1) not using Excel at all (best option in most cases), 2) letting the user to save Excel file and do whatever the user wants (I assume the user know better to open Excel or not).
If you want to generate Excel file, you can use Open XML SDK. Please see my past answer: How to add microsoft excel 15.0 object library from Add Reference in MS Visual Studio 2010[^].

—SA


这篇关于如何通过按钮单击c#表单打开Excel应用程序(excel.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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