Need to integrate Visio drawing/Shapes Templates

Started by SidRoy, February 16, 2009, 01:03:54 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

SidRoy

Hi,
I'm working on a C# application that uses Visio APIs. I need to integrate the File -> Shapes templates(eg. Business, Engineering, General etc . menu options) and their related stencils to my menubar and toolbar items. I can do this using the OpenEx command, but that would mean doing it individually for over a hundred templates.
Is there a way to do this dynamically so that the menu options and their related shape/stencil templates get populated and activated?

Thanks in advance,
Roy

Visio Guy

Hi SidRoy,

I haven't tried exactly what you want to do, but here are a few leads anyway.

Visio has a UI object model that lets you analyze the menu system. I don't know if the stencils and templates show up here, but you might try a quick test to see if they do.

But that won't really tell you which stencils open with which templates anyway.

I would probably create a tool that opens up the templates once, then creates an xml file/database that I could load as a resource.

If your templates and stencils are never changing, this would probably be a relatively easy solution to your problem.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

vojo

Or...in each template of interest, have backup page that has inventory of stencils opened  (maybe even some VBA to add/subtract from list as user/template evolve.

then on template open, you could interrogate this inventory without alot of stencil discovery in the template

Something like backup.inventory_shape!user.stencil1 = stencil1
                                                                        2 =         2

etc... (I would be surprised if you have more than say 20 stencils opened on any given template)

Your C# code could then just retrieve the inventory from the shape.

I am a novice at the Visio engine, but I believe that otherwise you would have to interrogate the shapes window to find all the open stencils...and if the user used shape search, probably need to filter that one out.