private void Application_WindowBeforeDoubleClick(Selection Sel, ref bool Cancel) { InlineShapes SelectedObj = Sel.InlineShapes; if (SelectedObj.Count == 0) { return; } InlineShape SelectedObjFirst = SelectedObj[1]; if (!SelectedObjFirst.AlternativeText.Contains("WordxTex_TexContent")) { return; } LaTexEdt CodeEditor = new LaTexEdt(false, SelectedObjFirst.AlternativeText, 0, 0); CodeEditor.ShowDialog(); }
private void btn_edit_Click(object sender, RibbonControlEventArgs e) { Microsoft.Office.Interop.Word.Document ThisDoc = Globals.ThisAddIn.Application.ActiveDocument; if (ThisDoc == null || ThisDoc.ReadOnly) { return; } InlineShapes SelectedObj = ThisDoc.Application.Selection.InlineShapes; if (SelectedObj.Count == 0) { return; } InlineShape SelectedObjFirst = SelectedObj[1]; if (!SelectedObjFirst.AlternativeText.Contains("WordxTex_TexContent")) { return; } LaTexEdt CodeEditor = new LaTexEdt(false, SelectedObjFirst.AlternativeText, 0, 0); CodeEditor.ShowDialog(); }