Ejemplo n.º 1
0
        private static void ExcelChops( )
        {
            Process [] Running = Process.GetProcessesByName("Excel");
            if (Running.Count() == 0)
            {
                return;
            }

            Microsoft.Office.Interop.Excel.Application ExcelApplication = (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject("Excel.Application");
            if (ExcelApplication == null)
            {
                return;
            }

            string        ActiveExcelApplicationCaption = ExcelApplication.Caption;
            Windows       ExcelWindows            = ExcelApplication.Windows;
            int           ExcelWindowCount        = ExcelWindows.Count;
            XlWindowState WindowState             = ExcelApplication.WindowState;
            Window        ExcelWindow             = ExcelApplication.Windows [1];
            String        ExcelWindoWindowCaption = ExcelWindow.Caption;

            System.Diagnostics.Debug.WriteLine(String.Format("\nExcel Application Caption {0} ", ActiveExcelApplicationCaption));
            System.Diagnostics.Debug.WriteLine(String.Format("\nExcel Window Caption {0} ", ExcelWindoWindowCaption));
            System.Diagnostics.Debug.WriteLine(String.Format("Excel Window Count {0} ", ExcelWindowCount));
            System.Diagnostics.Debug.WriteLine(String.Format("Excel Window State {0} ", WindowState));
            Microsoft.Office.Interop.Excel.Panes panes = ExcelWindow.Panes;
            IteratePanes(panes);
            ;

            Microsoft.Office.Interop.Excel.MenuBar aMB = ExcelApplication.ActiveMenuBar;
            IterateMenus(aMB, 0);
            System.Diagnostics.Debug.WriteLine(String.Format("{0} {1} ", "Completed", (((System.Environment.StackTrace).Split('\n')) [2].Trim( ))));
        }
Ejemplo n.º 2
0
        private static void IteratePanes(Microsoft.Office.Interop.Excel.Panes panes)
        {
            var n = panes.Count;

            for (int i = 1; i <= n; i++)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("{0} {1} ", "panes", (((System.Environment.StackTrace).Split('\n')) [2].Trim( ))));
            }
        }