Visio Guy

Visio Discussions => Programming & Code => Topic started by: MrSir on August 19, 2014, 08:20:08 AM

Title: Cant use shapes from template document stencil. - Visio 2013
Post by: MrSir on August 19, 2014, 08:20:08 AM
Hello

I have a template with 4 shapes in the document stencil, i can't use any of the them when i try to add shapes to the template from COM interop.
If i use a stencil file instead of a template file, everything works great, i suspect that the shapes from the document stencil is not Associated with a master, e.g:

Shape Screen from stencil: Master:Screen
Shape Screen from template: Screen:Screen

How do i fix this?

Regards MrSir
Title: Re: Cant use shapes from template document stencil. - Visio 2013
Post by: Paul Herber on August 19, 2014, 08:27:06 AM
If the shapes are in the document stencil that means that they are already in the template. The document stencil is part of the template.

P.S. any shapes in the document stencil are, by definition, masters. They don't have to be associated with anything.
Title: Re: Cant use shapes from template document stencil. - Visio 2013
Post by: MrSir on August 19, 2014, 08:43:29 AM
Hello Paul

Sorry, what i meant was i can't use the shapes when i use the template to create a new document.
I add the shapes this way:


Microsoft.Office.Interop.Visio.Master visioRectMaster = visioStencil.Masters.get_ItemU("Screen");
Microsoft.Office.Interop.Visio.Shape visioRectShape = visioPage.Drop(visioRectMaster, 4.25, 5.5);


I get an exception, because the shape type is not found in the document.

Regards MrSir
Title: Re: Cant use shapes from template document stencil. - Visio 2013
Post by: Paul Herber on August 19, 2014, 11:10:34 AM
What is visioStencil set to?
Is it set to a stencil? ( a real stencil, not the document stencil)
Does that stencil contain a shape called "Screen"?