예제 #1
0
 public static AccessExcel CreateInstance()
 {
     if (null == mSingletonAccessExcel)
     {
         mSingletonAccessExcel = new AccessExcel();
     }
     return(mSingletonAccessExcel);
 }
예제 #2
0
        //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());
            }
        }