public static AccessExcel CreateInstance() { if (null == mSingletonAccessExcel) { mSingletonAccessExcel = new AccessExcel(); } return(mSingletonAccessExcel); }
//button1,Excel测试按键 private void button1_Click(object sender, EventArgs e) { try { //Excel测试 mAccessExcel = AccessExcel.CreateInstance(); mDestinationExcelFile = MiscFunction.GetInstance().GetAssemblyPath() + Parameter.GetInstance().ReportDirectory + "\\" + "temp.xlsx"; File.Copy(mExcelModalFileName, mDestinationExcelFile, true); Application.DoEvents(); string ret = mAccessExcel.OpenExcelFile(mDestinationExcelFile); mAccessExcel.SetExcelVisible(); for (int i = 0; i < 1500; i++) { mAccessExcel.AddChipStatus(i, 1); } SaveResultToExcelFile(); } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }