Using WPF to draw hierarchical relationships


I created WPF app for some fight tournament. Input is from excel file and output is random generated names (matches) in word file.

I would like to programmatically create required elements add these names in elements that looks like this :


I was trying updating existing code using Microsoft.Office.Interop.Word smartArt but it's not going very well.. :)


Problem is in Nodes.Insert part having exception System.ArgumentException:

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

var myLayout = objDoc.Application.SmartArtLayouts[96];
var smartArtShape = objDoc.Shapes.AddSmartArt(myLayout, 50, 50, 200, 200);
Microsoft.Office.Core.MsoSegmentType msoSegment = Microsoft.Office.Core.MsoSegmentType.msoSegmentLine;
Microsoft.Office.Core.MsoEditingType msoEditingType = Microsoft.Office.Core.MsoEditingType.msoEditingAuto;
smartArtShape.Nodes.Insert(0, msoSegment, msoEditingType, 50, 50);
asked on Stack Overflow Feb 10, 2020 by Baneska • edited Feb 10, 2020 by Sir Rufo

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0