void Application_SheetSelectionChange(object Sh, Microsoft.Office.Interop.Excel.Range Target) { if (frm != null && frm.Status == "I") { _address = Target.get_AddressLocal(Target.Row, Target.Column, Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1, 0, 0); string address = _address.Replace("$", ""); string value = ""; try { value = Target.get_Value(type).ToString(); } catch { } frm.SetValueFocus(address, value); } }
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; } }