110,534
社区成员
发帖
与我相关
我的任务
分享
private void SaveTable()
{
Microsoft.Office.Interop.Excel.ApplicationClass ExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.WorkbookClass ExcelWorkBook = (Microsoft.Office.Interop.Excel.WorkbookClass)ExcelApp.Workbooks.Open(Application.StartupPath + "\\mybook.xls", Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value
, Missing.Value, Missing.Value, Missing.Value);
Microsoft.Office.Interop.Excel.Worksheet ExcelWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)ExcelWorkBook.Worksheets[1];
pm.GetEntitySize(pm.enumPowerMILLEntityType.pmModel, ModName, ref Xmin, ref Xmax, ref Ymin, ref Ymax, ref Zmin, ref Zmax);
ExcelWorkSheet.Cells[22, 5] = "X:" + ((Xmax - Xmin) / 2).ToString() + " Y:" + ((Ymax - Ymin) / 2).ToString() + " Z:" + (Zmax - Zmin).ToString();
//ExcelWorkSheet.Cells[5, 12] = Session;
//ExcelWorkSheet.Cells[32, 9] = Date;
//ExcelWorkSheet.Cells[2, 8] = Xmax;
//ExcelWorkSheet.Cells[2, 9] = Ymax;
//ExcelWorkSheet.Cells[2, 10] = Zmax;
//ExcelWorkSheet.Cells[3, 8] = Xmin;
//ExcelWorkSheet.Cells[3, 9] = Ymin;
//ExcelWorkSheet.Cells[3, 10] = Zmin;
ExcelWorkBook.Save();
ExcelApp.Quit();
ExcelApp = null;
ExcelWorkBook = null;
ExcelWorkSheet = null;
GC.Collect();
}