How to add a preview to a template


So, you've created a stencil and template for Visio and now you've also got it installed in Visio by creating an installer (.msi) for it. The problem is that the template just shows in Visio as a blank sheet. How do you get the images that appear with Microsoft's built-in templates?

You want something like this ...

nice initial startup screen
  but all you get is this ...

initial startup screen

Step 1 - Setting up Visio

Right, the first thing you need to do is start Visio, go to the Options -> Advanced dialog, and ensure that "Ensure all settings put in Windows registry" is set, close Visio,
start the registry editor, and go to:
where xx is the current version of Visio,
and change both values

ThumbnailDetailMaxSize = 5000000
ThumbnailDraftMaxSize = 5000000

These values affect the quality of the image stored within the template.

Step 2 - Choose your image

Next you need to determine what image you want to add to the template, I've chosen:

needed image

Whether this is an image or part of another Visio diagram is unimportant, as long as you know how to copy/paste it or insert it into a diagram. The image I'm using is part of a Visio document that I can select/copy/paste.

Step 3 - Open the template

Start Visio, then menu File -> Open, navigate to where the template (.vst or .vtx) is stored, select the file, and click Open.

Step 4 - I get the picture!

Now find the document from where you want to paste your image, select and copy it. Now paste or insert it into the open template and set its size and position. If you are working with templates for US and metric then its best to be comsistent with the size and position.
Open the Document shapesheet (menu View -> Drawing Explorer Window, then right-click on the drawing name), set PreviewQuality=1 and PreviewScope=0 then save the document.

Step 5 - Cleaning up

Now set LockPreview=TRUE, then close the shapesheet editor.
Select the image/shapes that you added and delete it/them. Now open the Document Stencil and delete all the surplus shapes added previously.
Save and close the template.

Step 6 - Build your installer

Now rebuild and run your installer, you should end up with this:

In the gallery section you will see something like this ...

result startup screen
and on the right-hand side you get this ...

right hand startup screen

Job done. Sweet!

P.S. These instructions are for Visio 2003/2007. If you have a later version of Visio using the ribbon the menu options will be different.


Dan M.
Thank you for this tutorial. I have downloaded a couple free stencils that didn't have a template file with them or a preview picture, so I was trying to create my own for organizational purposes. Could not find an example until I found a link you posted in a forum. Worked great. Too bad I don't have the tools to create a non blurred graphic, but that's OK. Much better than what I have.

Roger Billsdon
Unfortunately setting LockPreview to TRUE doesn't seem to work in Visio 2013. I reverted to an earlier version of Visio to add template previews.