示例#1
0
文件: Form1.cs 项目: Kgrah/Saver
        //grabs file handle of open excel instances
        public static void excelHandle()
        {
            var myApps = new ExcelAppCollection();

            string[] xlInst;
            IEnumerable <Process> procs = myApps.GetProcesses();

            foreach (Process p in procs)
            {
                int i = 0;
                try
                {
                }
                catch (Exception ex) { Console.WriteLine(ex); }
            }
        }
示例#2
0
文件: Test.cs 项目: Kgrah/Saver
        public static void excelHandle()
        {
            var myApps = new ExcelAppCollection();

            IEnumerable <Process> procs = myApps.GetProcesses();

            foreach (Process p in procs)
            {
                try
                {
                    Application a        = myApps.FromProcess(p);
                    string      fullPath = a.ActiveWorkbook.FullName;
                    Console.WriteLine(a);
                }
                catch (Exception ex) { Console.WriteLine(ex); }
            }
            Console.ReadLine();
        }