My last article looked at parsing an XML string with a known structure and order of elements and attributes. This can be acceptable in some scenarios, but what if the elements or attributes are in a different order? Then it is necessary to use the element and attribute names rather than their index position. This requires a little more complexity to the ShapeSheet functions, and this can result in longer processing time, so needs to be used cautiously, but it is possible, as I demonstrate in this article.
[Read more…] about More Parsing XML Data in Visio ShapesShapeSheet Functions
Parsing XML data in Visio Shapes
One of my current projects uses XML data, and some of the values in the XML data control the display and content of Visio shapes. Therefore, I looked deeper into how the XML data can be used directly to control parts of the graphics.
Although the external data linking feature in Visio Professional and Visio Plan 2 does have the ability to use XML files, the structure of these XML files is in a particular ADO format, and not suitable for the XML data in this project.
Also, Visio documents can have embedded XML data within it, and there are several methods available to work with the XML, such as Document.SolutionXMLElement. In fact, there are several ShapeSheet cells that can also hold SolutionXML too, as found in the Visio SDK :
The cell must be an A through D cell of the Scratch section or value cell of the User or Custom Properties section.
Custom Properties is the former name of Shape Data, and the SDK contains sample code for putting XML into the Document and a ShapeSheet cell. Unfortunately, the SolutionXML functions only work with the Document, not with a Cell.
Again, there does not seem to be a compelling reason to use SolutionXML with shape cells in my current project because it just adds extra characters, and slightly modifies the XML characters.
Visio cells can store very large amounts of text within them, and in this particular project, I have well structured XML with predictable elements and attributes. Similarly, there are many variations of books.xml on the web, ( small, medium, large ) which I have used for this article to demonstrate what can be done with XML in shapes.
In my case, I have created a Visio shape which has a Shape Data row to store the XML data, and other User-defined Cells to parse the XML data, then more Shape Data rows to just check the contents. I then have a 20 book sub-shapes that can become visible and display the information in the parent XML data automatically:
[Read more…] about Parsing XML data in Visio ShapesHighlighting dirty text in Visio shapes
I suppose I should explain what I mean by dirty text first 🙂
I often display the value of a Shape Data row in Visio text, but sometimes the solution requires that the value is also editable. This is ok if the client accepts that all editing is done with the Shape Data window or dialog, but not if the user more naturally wants to edit the text in the shape. In my current solution, I want to pass the manually edited text to another process for checking, and then only update the Shape Data row when validated or accepted, before re-setting the text with the inserted field. My first task was to spot with text had been manually overtyped, so I decided that checking the value of a new User-defined Cell, called IsDirty, was best, and then this value can be used to change the color of the text (or it could be the LineColor or FillForegnd) to make this value visible.
When Insert / Field is used in Visio, it creates a Text Fields section which can hold the reference to the inserted field.
If the text is manually overtyped, then the rows in the Text Fields section get deleted.
[Read more…] about Highlighting dirty text in Visio shapesPushing Data Visualizer in Visio beyond its limits
My last post was about some of the lessons learnt when trying to push Data Visualizer to its limits, but this one has some ways of overcoming these limitations. The main lesson learnt is that DV binds the shapes within the DV container shape, CFF Data Visualizer, and controls some of the ShapeSheet cells that are normally available for customization. The label of the connector is bound to the respective column in the Excel table, and that, combined with the ability to modify the Dynamic connector master shape provides a way of overcoming some of the limitations discovered.
So, given that we want to use DV, and we need to have multiple flows between the same shapes, then they cannot be separate connectors. We need to combine multiple flows onto the same connector, and then find a way to selectively display different flows somehow by controlling the visibility of the connectors. However, we cannot make them invisible because they will be deleted by DV, so we need to control their transparency instead. We can do this by interpreting the label somehow, and we are going to modify the Dynamic connector to react to the text of the label, and we can also change the colour and line pattern too.
The following screenshots show the Excel table with the multiple flows between the same shapes concatenated with pipe characters, and the diagram created by Data Visualizer when this table is imported into a custom template using Data \ Create from Data \ Create:
[Read more…] about Pushing Data Visualizer in Visio beyond its limitsA Visio List Shape is also a Container
Structured diagrams have been around in Microsoft Visio since 2010 and I have always known that list shapes are a specialized container shape, however it still came as a surprise to me recently that a list shape can simultaneously act as a container shape!
There are a few examples of both container and list shapes in the Microsoft provided content in all versions of Visio desktop, and even in the subscription Visio for web. The most popular of these is the Cross-Functional Flowchart template which contains container shapes (the Swimlane and Separator shapes) within list shapes (Swimlane List and Phase List), which are within another container shape (CFF Container).
In Visio desktop, the Insert / Diagram Parts / Container allows you to choose from a number of pre-built container shapes. There is no button to insert a list shape, but you can create your own or easily modify one of the pre-built ones to behave as a list shape.
[Read more…] about A Visio List Shape is also a ContainerTaking Visio Actions Rows to the limit
I recently (re-)discovered that there is a limit to the number of Actions section rows that will be evaluated for display on the right mouse menu of a Visio shape. I have not hit a limit (yet) for the number of rows that can be added to the Actions section … so why is there a limitation to the number that will be displayed on the right mouse menu? In Visio for desktop, any rows over this limit will simply not be displayed, but in Visio for web it prevents any Actions from being displayed at all on the shape.
[Read more…] about Taking Visio Actions Rows to the limit