Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're right - the Masters collection is ReadOnly. Documents normally start off with an empty masters collection. The collection gets populated by dropping masters from a stencil document.</p> <p>If you want to create a new document with a pre-populated Masters collection then you could create your own template (.vst) and then base your new document on that. For example:</p> <pre><code>Visio.Document vDoc = vDocs.Add("MyTemplateFile.vst"); </code></pre> <p>Normally you would package your stencils and templates together and then always create shapes by dropping a master from the respective stencil document (.vss).</p> <p>Masters also have a MatchByName property. Dropping a master when this property is set to true, Visio first checks that a master of the same exists in the drawing document masters collection. If it does an instance of that master will be dropped. If not a new master will be added based on the original stencil. Have a look at these two links for more information:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/aa201768%28office.10%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa201768%28office.10%29.aspx</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/ff766298.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ff766298.aspx</a></li> </ul> <p>If you really want to create your own masters in code, you can draw / drop your own shapes on the page and then use the Document.Drop method to add it to the masters collection.</p> <p>Also if you want to use a master by name then you'll need to loop through the masters collection to check that it exists before you use it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload