Exemple #1
0
        public List <Workbook> GetOpenWorkbooks()
        {
            var result = new List <Workbook>();

            Console.WriteLine(MsExcel.GetInstance()._excelApplication.Workbooks.Count);
            var it = GetInstance()._excelApplication.Workbooks.GetEnumerator();

            {
                while (it.MoveNext())
                {
                    result.Add(new Workbook((Excel.Workbook)it.Current));
                }
            }
            return(result);
        }
Exemple #2
0
 public static MsExcel GetInstance()
 {
     if (_instance != null)
     {
         return(_instance);
     }
     _instance = new MsExcel();
     try
     {
         _instance._excelApplication = BindToRunningProcessOrNew();
     }
     catch (Exception ex)
     {
         // todo log exception
         _instance = null;
     }
     return(_instance);
 }
Exemple #3
0
 public void Open(String Name)
 {
     MsExcel.GetInstance()._excelApplication.Workbooks.Open(Name);
 }