saveenr / VisioAutomation

Automate Microsoft Visio with .NET
Other
99 stars 43 forks source link

Change Graph Layout/Direction and Connectors from Curved to Straight?? #105

Open tcox8 opened 2 years ago

tcox8 commented 2 years ago

Is it possible to change the graph layout or graph direction when using the directedgraph XML? My hope would be to change the direction from LeftToRight and to change the connectors from curved to straight. I attempted to do this via the following code but it always draws it the same way. Note: the code below does not have the connectors from curved to straight as I couldn't find any documentation on the internet for that.

<directedgraph GraphDirection="LeftToRight" Layout="Sugiyama">
  <page>
    <renderoptions
          usedynamicconnectors="true"
          scalingfactor="20" />
    <shapes>
    ..............
tcox8 commented 2 years ago

Note: I tried using variations of the following but the page does NOT change:

$ls.LayoutDirection = "TopToBottom"
$ls.ConnectorStyle = "RightAngle"
$ls.ConnectorAppearance = "Straight"
Format-VisioPage -LayoutStyle $ls

I test that Format-VisioPage worked by using -Orientation and changing it back and forth from Landscape and Portrait.

tcox8 commented 2 years ago

Also, is the XML custom to this application? I cannot find documentation for the formatting of the XML anywhere. Anything close to the language doesn't seem to work. Another example, Attempting to add a subshape. Sorry for all the questions, and I appreciate any help you can provide.

tcox8 commented 2 years ago

I noticed "Get-VisioScriptingClient" fails out as it claims the function doesn't exist. I installed 4.2 but had the same issues. I then removed the entire Visio Module and installed version 3.4. Now Get-VisioScriptingClient works but I still have the same issues as my previous comments.

tcox8 commented 2 years ago

If I don't use the XML and instead use .AddShape and .AddConnection, I am able to change the layouts as need be with the Format-VisioPage function. I do wish that I had an answer for the XML as that would be ideal. Thanks again.