public void insertDiagram(UmlDiagram uml) { try { Selection currentSelection = Globals.ThisAddIn.Application.Selection; InlineShape shape; try { shape = currentSelection.InlineShapes.AddPicture(uml.getDiagramUrl()); } catch (Exception e) { String file = "c:/temp/yumlerror.png";//hack to extract image to file system. Stupid API. Image error = (System.Drawing.Image)Properties.Resources.ErrorImage; error.Save(file, ImageFormat.Png); shape = currentSelection.InlineShapes.AddPicture(file); } shape.AlternativeText = uml.getAltTextString(); shape.Select(); showTaskPane(); userControl.Diagram = uml; } catch (Exception e) { } }
public void insertDiagram(String type) { if (type == null) { type = "class"; } UmlDiagram uml = new UmlDiagram(type);//"class"); insertDiagram(uml); //currentSelection.TypeText(shape.AlternativeText); //currentSelection.TypeParagraph(); }
public void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e) { if (TaskPane.Visible) {//only bother updating if there's something to put data into. if (e.Selection.Type == WdSelectionType.wdSelectionInlineShape) { InlineShapes shapes = e.Selection.InlineShapes; if (shapes.Count > 0) { //InlineShape selectedShape; foreach (InlineShape shape in shapes) { //selectedShape = shape; userControl.Diagram = UmlDiagram.parseAltText(shape.AlternativeText); } } } else { userControl.Diagram = null; } } }