For the past two years, I have been adding XAML-based projects to my collection, alongside the normal Visio libraries and automation code that I normally produce. The reason is quite simple : both environments have the ability of linking vector graphics and data together in an exciting, interactive and controllable way. There is a certain smartness to both with the ability to binding data to graphical appearance. XAML seems to be present in all of Microsoft’s graphic products, in the form of WPF, Silverlight .and Xps. Now, we know that there are great things to come viz-a-viz Visio and XAML in the next version, and there is Saveen Reddy,s excellent Visio Export to XAML project on CodePlex ( https://www.openhub.net/p/VisioExportToXAML ), but most people do not realise that Xps is XAML, but compressed.
Visio
Creating an Org Chart without the Org Chart Wizard
Microsoft Office Visio has had an Org Chart Wizard for as long as I can remember (and I have been using Visio since 1996). It has gone through several iterations, but basically it provides a simple way to create personnel hierarchies from a variety of data sources. It even has a command line interface so that the charts can be created with a minimum of user interaction. This is great, but it is limited. Firstly, it does not take advantage of the new Link Data to Shapes and Data Graphics in Visio 207 Professional; secondly, it only does direct reports with just one type of layout; and thirdly, you cannot refresh the diagram easily. Therefore, I thought it would be interesting to overcome some of these obstacles using the new features of Visio 2007 Professional and with a little code.
Visio installs a sample OrgData.xls Excel spreadsheet in the folder <Program Files>Microsoft OfficeOffice12SAMPLES1033 by default, so I have copied this file and slightly amended it.
[Read more…] about Creating an Org Chart without the Org Chart WizardCopying Data from one Shape to Another
A recent newsgroup question asked for example code to demonstrate how shape data can be copied from one shape to another via a connector between the two. This is something that others might want to do also, and not just by connecting shapes, but also by selection since you might change your mind about which shape to use, but you have already entered a lot of information on the original shape. A good example of this might be when diagramming a network and needing to change between one type of server and another. So, in this blog, I will demonstrate how shape data can be transferred by connection or by selection, and how to limit the transfer to rows that match by name or by label.
Note that Shape Data is the new name for Custom Properties in Visio 2007.
Firstly, I should explain why it may be necessary to match by name or by label: In the following screenshot, you can see the Shape Data window, Define Shape Data dialog, and the ShapeSheet for a Server shape. I have ticked “Run in developer mode” in Tools / Options / Advanced, otherwise I would not be able to see the Name, Sort key, Ask on drop or Hidden in the dialog.
Displaying Inches as Fractions
I was recently asked if the Size & Position Window in Visio can display fractions of inches as fractions rather than as decimals. Well, most people are aware than you can type fractions into the Size & Position Window, but it is immediately translated into decimals, and I cannot find any way to keep the display as fractions, however you can link Shape Data (nee Custom Properties) to the width and height.
In the image below, I have added two Shape Data rows (Prop.Width and Prop.Height) and I have linked the values of the rows to the shape’s Width and Heights with the formulae =SETATREF(Width) and =SETATREF(Height).
Visio Viewer Developer Reference Released
Following on from my blog about the Microsoft Visio Viewer, I am delighted that Microsoft have published a developer reference for it (long overdue, but very welcome). See the MSDN pages at http://msdn.microsoft.com/en-us/library/cc297217.aspx and Visio Insight blog http://blogs.msdn.com/visio/archive/2009/01/14/developer-reference-for-visio-2007-viewer-released.aspx
Turning OFF The Cross Functional Flowchart Addon in Visio
Following on from my last blog, my colleague also needs to stop the Cross Functional Flowchart behaviour in a Visio Diagram. Well, I was almost fooled again into thinking that it might be as simple as removing the Persistent Events using the tool in the Visio SDK.
[Read more…] about Turning OFF The Cross Functional Flowchart Addon in Visio