private void AddRichTextControlAtSelection(string contentControlName) { try { Microsoft.Office.Interop.Word.Document currentDocument = Globals.ThisAddIn.Application.ActiveDocument; currentDocument.ActiveWindow.Selection.Select(); Microsoft.Office.Tools.Word.Document extendedDocument = Globals.Factory.GetVstoObject(currentDocument); richTextControl1 = extendedDocument.Controls.AddRichTextContentControl("rtc_" + Guid.NewGuid().ToString()); richTextControl1.PlaceholderText = contentControlName; richTextControl1.Title = contentControlName; richTextControl1.Tag = contentControlName; } catch (Exception ex) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)