Take the 2-minute tour ×

We need to create a Visio 2010 stencil in code, using the .NET Freamework and C#.

The idea is like this:

We have our app, that is used by the app user, and then we have the workflow designer, which user Visio which is installed on another machine.

So we have two different people and two different machines. Lets say that, for this discussion, the application is an organizational structure app, that its object model comprises of various types, including User, Group, Developer, Administrator etc..

I want to add functionality to the app that would allow the app user to take these types and create a stencil from it, saved in a .vss file which is the format Visio uses for stencils. Then, the Visio user can take this vss file and add it to the document he's working on. The idea behind all this is that the app user can add user types any time, say 'Power User', which makes all this process dynamic.

Now, the machine where the application is installed doesn't have Visio installed, which might be important, i guess, in terms of what assemblies related to visio programming can be referenced from the app.

Can this be achived?



share|improve this question
What is the source of the geometry or image used in the shapes? Does the App User specify this or is it defined somewhere else? If it is defined somewhere else what format is it in? –  Pat Leahy Jun 2 '11 at 4:40
add comment

1 Answer

up vote 0 down vote accepted

If you want to create a Visio stencil on a machine where you can't use the Visio API (i.e. where Visio is not installed or in a server scenario) you can create a Visio XML file. If you use the file extension VSX then Visio will treat it as a stencil. Creating shapes in a Visio XML file may be much more complicated than creating shapes using the API because you will have manage many things yourself which Visio normally takes care of such as collection IDs, formula evaluation, connection creation, etc.

This approach assumes the definition of the geometry or image to use the shapes is predefined and accessible from your stencil generation code. If the user creating the stencil needs to specify the geometry then you may need to integrate some drawing tool. Visio may be that tool or you could investigate other drawing tools which can create a file which Visio can read, e.g. SVG.

share|improve this answer
Great info there Pat, thanks a lot. It seems that the xml way is the only way for me to go. I will let you know if I can manage to get it right with that solution. Again thank you very much. –  Avi Shilon Jun 2 '11 at 8:02
add comment

Your Answer


