Ejemplo n.º 1
0
        void _oBtnComment_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 (frm == null)
            {
                frm             = new QDAddIn(_address, Application, formular, _strConnect, _strConnect);
                frm.Config      = _config;
                frm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frm_FormClosed);
                //frm.Pos = _address;
                //frm.TopMost = true;
                frm.Show(new WindowWrapper((IntPtr)Application.Hwnd));
            }
            //else if (frm.DialogResult == System.Windows.Forms.DialogResult.Yes)
            //{
            //    frm.BringToFront();
            //    frm.GetQueryBuilderFromFomular(formular);
            //}
            else
            {
                frm.Close();
                frm             = new QDAddIn(_address, Application, formular, _strConnect, _strConnectDes);
                frm.Config      = _config;
                frm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frm_FormClosed);
                //frm.Pos = _address;
                //frm.TopMost = true;
                frm.Show(new WindowWrapper((IntPtr)Application.Hwnd));
            }
        }
Ejemplo n.º 2
0
        private void ShowDesign()
        {
            if (_user == "")
            {
                MessageBox.Show("Please login...");
                return;
            }
            Excel._Worksheet sheet = (Excel._Worksheet)ExcelApp.ActiveSheet;
            _xlsCell = (Excel.Range)ExcelApp.ActiveCell;
            string _address = _xlsCell.get_AddressLocal(1, 1, Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1, 0, 0).ToString();

            _address = _address.Replace("$", "");
            string formular = _xlsCell.Formula.ToString();

            if (frm == null)
            {
                frm             = new QDAddIn(_address, ExcelApp, formular, _strConnect, _strConnectDes);
                frm.User        = _user;
                frm.Config      = _config;
                frm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frm_FormClosed);
                //frm.Pos = _address;
                //frm.TopMost = true;
                IWin32Window wincurrent = new WindowWrapper((IntPtr)ExcelApp.Hwnd);
                frm.Show(wincurrent);
            }
            //else if (frm.DialogResult == System.Windows.Forms.DialogResult.Yes)
            //{
            //    frm.BringToFront();
            //    frm.GetQueryBuilderFromFomular(formular);
            //}
            else
            {
                frm.Close();

                frm             = new QDAddIn(_address, ExcelApp, formular, _strConnect, _strConnectDes);
                frm.User        = _user;
                frm.Config      = _config;
                frm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frm_FormClosed);
                //frm.Pos = _address;
                //frm.TopMost = true;
                IWin32Window wincurrent = new WindowWrapper((IntPtr)ExcelApp.Hwnd);
                frm.Show(wincurrent);
            }
        }