Skip to content

Directed graph XML: expose document, shape and connector options (part of #225) - #230

Merged
saveenr merged 5 commits into
masterfrom
implement-225-xml-options
Oct 1, 2026
Merged

saveenr merged 5 commits into
masterfrom
implement-225-xml-options

Conversation

@saveenr

@saveenr saveenr commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the agreed first tier of #225: more of the directed graph model can be set from the directed graph XML format. Every addition is optional, so existing XML loads unchanged. This is part of #225, not all of it (see "Not included").

New XML

  • <documentoptions template borderwidth borderheight> as a child of <directedgraph> (a new element, so the root still takes no attributes). If only one border attribute is given the other keeps its default.
  • On <shape>: width and height (both or neither); <hyperlink name address subaddress description> children (the url attribute's link stays first); a <cells><cell name value/></cells> child that sets any ShapeCells property by name (case-insensitive, unknown names throw); and <customprop> gains type (string, number, boolean, date), label, prompt and format.
  • On <connector>: a per-edge connectortype that overrides the page setting, a <cells> child (explicit cells win over the color, weight and arrow defaults), and <customprop> children.

Renderer fix

MsaglRenderer now applies Edge.CustomProperties to the drawn connector (dynamic and Bezier). It previously ignored them, so connector custom properties could not have worked from any path.

Not included, and why

Testing

  • 23 new tests in DirectedGraphXmlOptionsTests (loader tests plus live drawing tests).
  • Debug build, local Visio: VTest.Models 103/103, VTest.Scripting 43/43, VTest.PowerShell 27/27.
  • End to end through PowerShell (Import-VisioModel x.xml | Out-VisioApplication) with an XML file using the new options: sizes, fill color, both hyperlinks, number and boolean custom properties, the connector's arrow and custom property all reached the drawn shapes.

Notes

  • NuGet/CHANGELOG.md [Unreleased] gets an Added section and a Fixed entry.
  • I did not update the test counts in docs/TESTING.md or CLAUDE.md: PR Fix DrawOrgChart resizing the target page #228 edits the same lines. They need a refresh after both merge.
  • The matching GitBook page is a companion PR in saveenr/VisioAutomation_GitBook_Docs.

Refs #225, #229

🤖 Generated with Claude Code

TheSevenPens and others added 3 commits October 1, 2026 04:51
Adds optional XML for more of the DirectedGraphDocument model (part of #225):
a <documentoptions> element (template, borderwidth, borderheight);
pageborderwidth/pageborderheight on <renderoptions>; on <shape> width and
height, <hyperlink> children, a <cells> element (any ShapeCells property by
name) and typed <customprop> (type, label, prompt, format); and on <connector>
a per-edge connectortype, <cells> and <customprop>. Everything is optional, so
existing XML loads unchanged.

MsaglRenderer now applies Edge.CustomProperties to the drawn connector (it
previously ignored them) for both dynamic and Bezier connectors.

24 new tests in DirectedGraphXmlOptionsTests (loader and live drawing).
DefaultShapeSize and per-edge master/stencil are not exposed; DefaultShapeSize
is never used for nodes because masters resolve their sizes first.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
DirectedGraphDocument.Template goes to NewDocumentFromTemplate, which opens the
template as a docked stencil and returns a blank document (filed as #229). The
new test only checks that the option is accepted and the graph still draws.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
pageborderwidth/pageborderheight have no effect on the XML path: after the
renderer sizes the page, DrawDirectedGraphDocument resizes it again using the
document's BorderSize, which wins (live-verified: a page border of 3 gave the
same page width as the default, a document border of 3 doubled it). Exposing a
no-op option would mislead, so only the document-level borderwidth and
borderheight remain.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TheSevenPens and others added 2 commits October 1, 2026 05:08
Resolves the CHANGELOG conflict with the DrawOrgChart fix (both entries kept)
and refreshes the test counts, CLAUDE.md state and the Models docs backlog entry
for the XML options.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@saveenr
saveenr merged commit bc8ec0c into master Oct 1, 2026
2 checks passed
@TheSevenPens
TheSevenPens deleted the implement-225-xml-options branch October 1, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants