コード例 #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( ))));
        }
コード例 #2
0
        private static WindowState ConvertState(XlWindowState innerState)
        {
            switch (innerState)
            {
            case XlWindowState.xlMaximized: return(WindowState.Maximized);

            case XlWindowState.xlMinimized: return(WindowState.Minimized);

            case XlWindowState.xlNormal: return(WindowState.Normal);

            default: throw Requires.ValidEnum((int)innerState);
            }
        }