- using Microsoft.Office.Interop.Excel;
- namespace Reports
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- public void test()
- {
- ;
- }
- private void report1ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); //引用Excel对象
- Microsoft.Office.Interop.Excel.Workbook book = excel.Application.Workbooks.Add("d:\\test.xls");
- //引用Excel工作簿
- excel.Visible = true; //使Excel可视
- }
- private void report2ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- System.Diagnostics.Process.Start("d:\\test.xls");
- }
- }
- }
c#打开excel
最新推荐文章于 2023-03-21 11:34:31 发布