Exemple #1
0
        void _oBtnAnalysis_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            Excel._Worksheet sheet = (Excel._Worksheet)Application.ActiveWorkbook.ActiveSheet;
            _xlsCell = (Excel.Range)Application.ActiveCell;
            string _address = _xlsCell.get_AddressLocal(1, 1, Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1, 0, 0).ToString().Replace("$", "");
            string formular = _xlsCell.Comment.Text(Type.Missing, Type.Missing, Type.Missing);

            if (frmdrill == null)
            {
                frmdrill             = new QDAddinDrillDown(_address, Application, formular, _strConnectDes);
                frmdrill.Config      = _config;
                frmdrill.FormClosed += new FormClosedEventHandler(frmdrill_FormClosed);
                //frm.Pos = _address;
                //frm.TopMost = true;
                frmdrill.Show(new WindowWrapper((IntPtr)Application.Hwnd));
            }
            //else if (frmdrill.DialogResult == System.Windows.Forms.DialogResult.Yes)
            //{
            //    frmdrill.BringToFront();
            //    frmdrill.GetQueryBuilderFromFomular(formular);
            //}
            else
            {
                frmdrill.Close();
                frmdrill             = new QDAddinDrillDown(_address, Application, formular, _strConnectDes);
                frmdrill.Config      = _config;
                frmdrill.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frmdrill_FormClosed);
                //frm.Pos = _address;
                //frm.TopMost = true;
                frmdrill.Show(new WindowWrapper((IntPtr)Application.Hwnd));
            }
        }
Exemple #2
0
        private void ShowAnalysis()
        {
            Excel._Worksheet sheet = ExcelApp.ActiveSheet as Excel.Worksheet;
            _xlsCell = (Excel.Range)ExcelApp.ActiveCell;
            string _address = _xlsCell.get_AddressLocal(1, 1, Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1, 0, 0).ToString().Replace("$", "");

            if (_xlsCell.Comment != null)
            {
                string formular = _xlsCell.Comment.Text(Type.Missing, Type.Missing, Type.Missing);
                if (frmdrill == null)
                {
                    frmdrill             = new QDAddinDrillDown(_address, ExcelApp, formular, _strConnectDes);
                    frmdrill.User        = _user;
                    frmdrill.Config      = _config;
                    frmdrill.FormClosed += new FormClosedEventHandler(frmdrill_FormClosed);
                    //frm.Pos = _address;
                    //frm.TopMost = true;
                    frmdrill.Show(new WindowWrapper((IntPtr)ExcelApp.Hwnd));
                }
                //else if (frmdrill.DialogResult == System.Windows.Forms.DialogResult.Yes)
                //{
                //    frmdrill.BringToFront();
                //    frmdrill.GetQueryBuilderFromFomular(formular);
                //}
                else
                {
                    frmdrill.Close();
                    frmdrill             = new QDAddinDrillDown(_address, ExcelApp, formular, _strConnectDes);
                    frmdrill.User        = _user;
                    frmdrill.Config      = _config;
                    frmdrill.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frmdrill_FormClosed);
                    //frm.Pos = _address;
                    //frm.TopMost = true;
                    frmdrill.Show(new WindowWrapper((IntPtr)ExcelApp.Hwnd));
                }
            }
            else
            {
                MessageBox.Show("Cell selected is incorrect!");
            }
        }