private Tools.ContentControl AddTextControlAtSelection(string name) { Tools.Document vstoDoc = Globals.Factory.GetVstoObject(activeDoc()); Tools.ContentControl cc = vstoDoc.Controls.AddContentControl(name, Word.WdContentControlType.wdContentControlRichText); return(cc); }
/// <summary> /// Adds a new link to the document registered links, temporarily until it's saved /// </summary> /// <param name="name">name of the link</param> /// <param name="URL">URL of the link</param> /// <param name="cc">The content control associated to the link</param> public void addNewLink(string name, string URL, Tools.ContentControl cc) { //A new link has been added. Store it in the ccToLinks dictionary Link l = new Link(name, URL, cc.ID); try { ccToLinks[Int32.Parse(getStringProperty(DOC_ID_PROPERTY))].Add(cc.ID, l); } catch (Exception e) { sayWord(e.ToString()); } finally { Console.WriteLine("Dolor"); } }
public void uploadLink(string[] paths) { foreach (string path in paths) { string name = Path.GetFileName(path); Tools.ContentControl cc = Globals.ThisAddIn.createDriveContentControl(); Task.Factory.StartNew(async() => { string result = await getDriveEmbedding().uploadLink(cc.Range, path, name); cc.LockContents = true; //If the creation was successful, store the link if (!result.Equals("")) { addNewLink(name, result, cc); } }); } }
private void AddCC_Click(object sender, RibbonControlEventArgs e) { Tools.ContentControl cc = Globals.ThisAddIn.createDriveContentControl(); Globals.ThisAddIn.sayWord("ID: " + cc.ID); }