Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: danielle on November 12, 2014, 05:05:04 PM

Title: Custom Templates XML (Start Screen/Deployment)
Post by: danielle on November 12, 2014, 05:05:04 PM
Hi,

I have created some custom visio templates using an XML file and i was just wondering if anyone knows what the application id is for Visio?

Example below - I can only find what it is for Excel Powerpoint and word.


?xml version="1.0" encoding="utf-8"?>
<o:featuredcontent lcid="1033" xmlns:o="urn:schemas-microsoft-com:office:office">
    <o:application id="WD">
        <o:featuredtemplates startdate="2011-03-01" enddate="2013-03-01">
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Nikolay on November 12, 2014, 07:24:41 PM
Hi, it is "VO"
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Nikolay on November 12, 2014, 08:04:37 PM
BTW, it looks like danielle found an easy way to make Visio templates appear on the start screen!
All you need to do is to author an xml file with the content like this one (note the "VO"):


<?xml version="1.0" encoding="utf-8"?>
<o:featuredcontent lcid="1033" xmlns:o="urn:schemas-microsoft-com:office:office">
   <o:application id="VO">
        <o:featuredtemplates startdate="2007-01-01" enddate="2017-01-01">

           <!-- TEMPLATE 1 -->
           <o:featuredtemplate title="[Your template title]" source="[path to the template].vst" >
              <o:media mediatype="gif" filename="[thumbnail file name].gif" source="[path to thumbnail file].gif" />
              <o:preview filename="[preview file name].gif" source="[path to preview file].gif" />
           </o:featuredtemplate>

        </o:featuredtemplates>
    </o:application>
</o:featuredcontent>


Then set ServiceURL registry value at path HKEY_CURRENT_USER\Software\Microsoft\Office\[office version]\Common\Spotlight\Providers\[category name] to the path to that file, and you are done!

AFAIR historically this was sort of hardcore actually. Interesting that there seems to be an easy option.
I mean, there is this "Solution Publishing Tool" in Visio SDK which allows one to "publish" templates (and other things).
I've even authored a Visual Studio extension to allow easier integration of that "publishing" stuff in setup.
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Visio Guy on November 13, 2014, 01:23:55 PM
Interesting. My Office\14.0 and \15.0 don't even have a Spotlight leaf by default. Some questions that come to mind:
I'm investigating some more...
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Nikolay on November 13, 2014, 01:55:00 PM
Quote from: Visio Guy on November 13, 2014, 01:23:55 PM
Interesting. My Office\14.0 and \15.0 don't even have a Spotlight leaf by default. Some questions that come to mind:

  • Also, I wonder what you do if you want more than one template? Or is it for a category that maps to a directory full of templates?
  • What are the rights of an install program to create these registry keys?
  • Does the solution publishing tool create these registry entries and xml files?
I'm investigating some more...

I have also investigated a bit :)

- By default, there is no "Spotlight" key, one has to create it manually.
- It looks like you can have as many templates and categories as you want. To create a category, you register a new file under [category name] in the registry. To add more templates to the category, you append them to the list in the XML file - seems to work fine.
- The key can be created by a restricted user (it's under HKCU). No Admin permissions required.
- The "solution publishing tool" does something completely different (it uses the "PublishComponent" MSI table to fill the publication data windows installer registry). Nothing like "Sportlight" or this XML file is created.

That means, it looks like Visio has 2 alternative (hopefully not conflicting) ways to fill templates on the start screen. First is the "old" method which gets the data from the windows installer; the second one is this "Spotlight" way which obviously comes from the Office package.
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Visio Guy on November 13, 2014, 02:24:37 PM
These are my findings:

First, two articles:

Interesting points:
When Visio starts, it adds another key at ...Common\Spotlight\Content\MyCoolCategory (see second attached image). This has a bunch of keys under it. These are generated the first time you start Visio after adding the configuration file and the reg keys.

Below you can see the result for Visio 2010. Note the Custom Template category "Chris" in the top screenshot. In the bottom, not how the template icon and preview are different images (the preview has red squiggles).
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Visio Guy on November 13, 2014, 02:39:16 PM
I should mention here what I usually do for customers, i.e. a THIRD way to "publish" content and custom templates:

This way is much easier than the xml/registry version. But the method discussed in this thread allows you to have separate template and preview images. So, say, a template icon could be fairly simplistic, but the preview image could be more detailed.

I would also propose that putting templates in My Shapes might be a "standard" that Visio content developers follow. It makes a lot of sense, and it is easy to track down files, debug errors, etc.
Title: Re: Custom Templates XML (Start Screen/Deployment)
Post by: Visio Guy on November 13, 2014, 02:43:39 PM
One more note:

Using the xml/categories method is Visio version-specific. I run both Visio 2010 and 2013 on my machine. After configuring for Visio 2010 and checking that everything worked, I then switched to Visio 2013. The custom category and templates did NOT appear.

If you use the File Paths method to specify a templates directory, this does carry from Visio 2010 to Visio 2013, as they must read the same registry settings...? Perhaps this explains the lengthy "Installing..." procedure that occurs every time you start different versions of Visio on the same machine.