我有这个非常基本的数据导出到Excel的应用程序:
Microsoft.Office.Interop.Excel.Application xlsApp = new Microsoft.Office.Interop.Excel.Application();
Workbook wb = xlsApp.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws = (Worksheet)xlsApp.ActiveSheet;
xlsApp.Visible = true;
ws.Cells[1,1] = "First Name";
ws.Cells[1,2] = "Last Name";
ws.Cells[2,1] = "Mary";
ws.Cells[2,2] = "Poppins";
ws.Cells[3,1] = "Grace";
ws.Cells[3,2] = "Kelly";
我需要修改它,以便xls文件在我的电脑中未打开,但只需创建和保存。 我怎么能?
谢谢!
答案 0 :(得分:0)
您可以尝试将Excel.Application-Object的属性“Visible”设置为false:
xlsApp.Visible = false;