我现在导出之后,直接就是默认到D盘的,我现在想做成动态的,可以选择路径。 private void MenuItem_Click(object sender, RoutedEventArgs e) { System.Data.DataTable datatable = new System.Data.DataTable(); Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application(); try { //lz 路径选择 excelApp.Visible = false; Workbook excelWB = excelApp.Workbooks.Add(System.Type.Missing); Worksheet excelWS = (Worksheet)excelWB.Worksheets[1]; Range celulas = null; celulas = excelWS.get_Range("A1", System.Type.Missing); excelWS.Cells[1, 1] = ""; excelWS.Cells[1, 2] = "控制柜名称"; excelWS.Cells[1, 3] = "控制柜分类"; excelWS.Cells[1, 4] = "时间"; excelWS.Cells[1, 6] = "工作模式"; excelWS.Cells[1, 8] = "报警状态"; excelWS.Cells[1, 10] = "输入电压"; excelWS.Cells[1, 11] = "输出电压"; excelWS.Cells[1, 12] = "输出电流"; excelWS.Cells[1, 13] = "一路"; excelWS.Cells[1, 14] = "二路"; for (int i = 0; i
添加回答
举报
0/150
提交
取消