I have a Visio stencil document with some shapes and I want to add a shape contained inside it to my document. Based on [this example](https://learn.microsoft.com/sr-cyrl-rs/visualstudio/vsto/how-to-programmatically-add-shapes-to-a-visio-document?view=vs-2017) I was able to do it, the only issue is how to get rid of the dock panel which appears when opening stencil using `Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked` flag.

So after import I close the opened stencil document but the dock panel stays. Maybe I could close it programmatically too, but then I should consider complicated logic with tracking wheater this was opened or not to keep UI unchanged if the user opened this panel previously etc.

My question is there another option to import a shape from a stencil or a workaround for this panel and stencil document opening options (for instance to open stencil document hidden for user and close it afterwards silently)

```
            // Microsoft.Office.Interop.Visio.Application Application
            var documents = Application.Documents;
            var document = documents.Add("");
            var page = Application.ActivePage;
            var visioStencil = documents.OpenEx(
                @"c:\Users\user\Desktop\stencil.vssx",
                (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);
            var masters = visioStencil.Masters;

            for (var i = 1; i <= masters.Count; ++i)
            {
                var item = masters.get_ItemU(i);
                var name = item.Name;

                if (name == "Master.2")
                {
                    page.Drop(item, 10, 10);
                    break;
                }
            }

            visioStencil.Close();

```