Achilles
Achilles

Reputation: 117

Removing Stencils from Visio Document

Is there any ways to remove an existing Stencil from a Visio Document ? (C# Win App)


I Couldnt find a way to remove an existing stencil. But here is a sample to Add 1.

VisioDrawing.Document.Application.ActiveDocument.OpenStencilWindow();
VisioDrawing.Document.Application.Documents.OpenEx(_StencilPath + "BASFLO_M.vss",
(short)VisOpenSaveArgs.visOpenDocked);

Upvotes: 1

Views: 2858

Answers (3)

KSW
KSW

Reputation: 1

If don't want/need the stencils to load you can rename the Visio Content folder that stores the stencils.

For Visio2013 it's C:\Program Files (x86)\Microsoft Office\Office15\Visio Content\1033. Add a new folder and dump the files in there. This hides the stencils so that Visio cant see them. Then launch your Visio file.

Upvotes: 0

Jon Fournier
Jon Fournier

Reputation: 4327

If you have multiple documents open using the same stencil, you should be able to just close the stencil window for the drawing. That way, you don't close stencils from other documents.

So to do this, you'd find the window for the document from within Visio.Application.Windows, then look through that Window's window list, and for each one see if its document is the one you want to close. Then you just call the close method on that window. When you save the file, the stencil is no longer attached to that drawing.

Upvotes: 2

user9182
user9182

Reputation:

You can simply close the open stencil, e.g.:

VisioDrawing.Document.Application.Documents.Item("BASFLO_M.vss").Close();

Upvotes: 1

Related Questions