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); }
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); }
public void Open(String Name) { MsExcel.GetInstance()._excelApplication.Workbooks.Open(Name); }