Exemple #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));
            }
        }
Exemple #2
0
        private void ShowComment()
        {
            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().Replace("$", "");

            if (_xlsCell.Comment != null)
            {
                string formular = _xlsCell.Comment.Text(Type.Missing, Type.Missing, Type.Missing);
                if (frm == null)
                {
                    frm             = new QDAddIn(_address, ExcelApp, formular, _strConnect, _strConnect);
                    frm.User        = _user;
                    frm.Config      = _config;
                    frm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frm_FormClosed);
                    //frm.Pos = _address;
                    //frm.TopMost = true;
                    frm.Show(new WindowWrapper((IntPtr)ExcelApp.Hwnd));
                }
                //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;
                    frm.Show(new WindowWrapper((IntPtr)ExcelApp.Hwnd));
                }
            }
            else
            {
                MessageBox.Show("Cell selected is incorrect!");
            }
        }
Exemple #3
0
        void Application_SheetBeforeDoubleClick(object Sh, Microsoft.Office.Interop.Excel.Range Target, ref bool Cancel)
        {
            //string _address = "A1";
            _address = Target.get_AddressLocal(Target.Row, Target.Column, Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1, 0, 0).Replace("$", "");
            string formular = Target.Formula.ToString();

            if (formular.Contains("TT_XLB_EB") || formular.Contains("USER TABLE"))
            {
                //Target.set_Value(Type.Missing, formular);
                //Application.Undo();
                if (frm != null)
                {
                    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;
                    //if (value.Contains("TT_XLB_ED"))
                    //    frm.GetQueryBuilderFromFomular(value);
                    //frm.TopMost = true;
                    frm.Show(new WindowWrapper((IntPtr)Application.Hwnd));
                }
                else
                {
                    frm             = new QDAddIn(_address, Application, formular, _strConnect, _strConnectDes);
                    frm.Config      = _config;
                    frm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frm_FormClosed);
                    //frm.Pos = _address;
                    //if (value.Contains("TT_XLB_ED"))
                    //    frm.GetQueryBuilderFromFomular(value);
                    //frm.TopMost = true;
                    //
                    frm.Show(new WindowWrapper((IntPtr)Application.Hwnd));
                }
                frm.Focus();
                Cancel = true;
            }
        }