If you develop addins / templates / stencils for Visio, sooner or later you come to a question, how do you deploy them. Visio allows you to deploy your solution / template in such a way that template / stencil can be embed nicely in Visio user interface, thus showing up just like all other Visio built-in templates. For Visio developers, Visio SDK provides the Solution Publishing Tool, which is an official way to publish Visio-related components. However this nice tools has a number of limitations, in particular:
– It does not integrate well into automated build process, when you e.g. use a continuous integration using a build server.
– it uses scripting custom vbscript actions which may become a problem with some stupid anti-virus programs or in some very restricted environments.
Windows Installer Xml (WiX) builds Windows installation packages from XML source code, and integrates seamlessly into build processes. The toolset originates from Microsoft, which used it internally to build Microsoft Office installers. The tool is super-cool and rock-solid =)
This post explains the magic behind the Visio Solution Publishing tool and shows how you can do the same thing with WiX, by creating an installer which will install template and stencil. Also the post includes sample / template WiX solution to install Visio files, both for Visio x86 and Visio x64.
Updated the recently published map:
- Added related page to the with some pictures and video =)
– Now all regions are stored alphabetically (yep, they were not)
– Now you can install this template using installer (and it will show up in Visio templates – in category "Maps and Floor Plans".
- Preview picture for the template enhanced using technique described here.
Each region shape in a stencil is equipped with shape-data which includes region name (in English and in Russian), region code, macro-region name, capital, and some other potentially useful fields. You can easily bind this to some data you have to build a nice diagram with external data, e.g. see examples below with "macro-regions" and "population".
You can use your custom data (e.g. from Excel file) to add some extra information to the map, e.g. to color it by region:Demo_VisioMap1.zip (746.1 KiB)
Also you can bind that data to shapes – e.g. I used excel file from the official site as "external data" to show population (also Visio theme applied):Demo_VisioMap2.zip (1.0 MiB)
Please check out also functions "Arrange to Page" and "Arrange to Shape" from the "world map" shapes.
After you drag the shapes you want to use onto the drawing page, you can arrange them to form a region as follows:
Press SHIFT and then click to select each of the shapes.
Right-click one of them, and then click Arrange To Page.
Visio will automatically place corresponding shapes together. If you want the map shapes to fill the entire drawing page, select the Size shapes to fill the drawing page check box. To add more shapes to a region:
- Drag the additional shapes onto the drawing page.
- Press SHIFT and then click to select each of the new shapes.
- Right-click one of them, and then click Arrange To Shape.
- On the drawing page, click a shape in the region that you want to align the new shapes to, and then in the Arrange To Shape dialog box, click OK
The map is available in 3 fashions – zip file with template/stencil and installer for Visio x86/x64.
|RussiaMapVisio_04_2012.zip||RussiaMapVisio 04 2012||914.3 KiB||04.04.2013|
|VisioMapOfRussia_20_04_2013.zip||Maps of Russia regions (Visio template and stencil, in zip file)||489.1 KiB||20.04.2013|
|VisioMapOfRussia_20_04_2013_x64.msi||Maps of Russia regions (Visio template and stencil, packed in installer for Visio x64)||600.0 KiB||20.04.2013|
|VisioMapOfRussia_20_04_2013_x86.msi||Maps of Russia regions (Visio template and stencil, packed in installer for Visio x86)||596.0 KiB||20.04.2013|
This is Visio map of Russia (year 2012). The map is in Visio VSD format. Includes a stencil with all regions as separate shapes and “assemled” sample drawing. The map was built to work nicely with the standard Visio “maps” functionality (like World Map), and additionally includes items which are specific to regions in Russia (region ISO code, capital, etc) as shape data. Download and details follow.
I have updated the Find Visio Command Addin to work with Visio x64 version, and added support for German, Russian, and Japaneese languages.
You can download the latest version from the plugin’s page.
Have you ever tried to find a particular command in new Visio 2010 user interface? This was a little bit frustrating for me and I decided to develop a simple add-in which allows you to quickly find commands in Visio 2010. Just type in the keyword which is a part of command name, and hit enter. All commands which contain this keyword will be shown by the plugin as buttons. You can either use the command found directly from the results pane, or add it to the quick launch toolbar.
The big picture:
If you write a Visio add-in that targets multiple Visio versions at the same time, and have some custom buttons with images (with transparency), you might run into trouble with that new Visio 2010 Ribbon user interface needs different “flavor” of images compared to Visio 2003 and 2007. So you’ll have to to either create two separate sets of images (one set for pre-ribbon version of Visio, the second set for the ribbon one), or to “dance around a little” and make both versions consume the same set of images. The article focuses on the second approach I ended up with.
This article explains this post in microsoft.public.visio.developers newsgroup, and provides information on how one can to save Visio shapes in external source exactly, so here is the code to store master/shape in a stream and then drop it back to the document:
To save Visio shapes in some external system (persist them) you can:
– Query master or shape you want to persist for IDataObject interface.
– Using this interface, obtain data blob in “Visio 11 Shapes” clipboard format (or maybe actually anything that contains “Shapes” word to be compatible with further Visio versions, please refer to the code).
Now this blob can be stored any way you want (database/memory/file/whatever). The sample code just saves it to a string variable in base64 encoding. To drop shapes back to the drawing, you can use “Drop” functions of Visio document/page. It turned out that these functions are happy enough with plain IDataObject interface passed in. So, to drop the stored master or shape back to the drawing:
– Create you own object that implements IDataObject interface.
– Load this object with your data
– Pass this object in one of those “Drop” functions (e.g. Page.Drop)