Cant use shapes from template document stencil. - Visio 2013

Started by MrSir, August 19, 2014, 08:20:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MrSir

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

Paul Herber

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.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

MrSir

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

Paul Herber

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"?

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/