Author Topic: Custom Templates XML (Start Screen/Deployment)  (Read 7585 times)

0 Members and 1 Guest are viewing this topic.

danielle

  • Newbie
  • *
  • Posts: 1
Custom Templates XML (Start Screen/Deployment)
« on: November 12, 2014, 12: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">
« Last Edit: November 13, 2014, 08:25:04 AM by Visio Guy »

Nikolay

  • Hero Member
  • *****
  • Posts: 945
    • UnmanagedVisio
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #1 on: November 12, 2014, 02:24:41 PM »
Hi, it is "VO"
« Last Edit: November 13, 2014, 08:25:18 AM by Visio Guy »

Nikolay

  • Hero Member
  • *****
  • Posts: 945
    • UnmanagedVisio
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #2 on: November 12, 2014, 03: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"):

Code
<?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.
« Last Edit: November 13, 2014, 08:25:30 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #3 on: November 13, 2014, 08:23:55 AM »
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...
« Last Edit: November 13, 2014, 08:27:13 AM by Visio Guy »
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nikolay

  • Hero Member
  • *****
  • Posts: 945
    • UnmanagedVisio
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #4 on: November 13, 2014, 08:55:00 AM »
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.

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #5 on: November 13, 2014, 09:24:37 AM »
These are my findings:

First, two articles:

Interesting points:
  • The xml configuration file can point to several templates, which will fall into your custom category
  • The category shows as a folder under Custom Templates in Visio's "Start" page
  • The configuration has options for a template thumbnail and a preview image
  • The templates and images can be in different folders, as long as the configuration points to the right location
  • The configuration can't use relative or %userprofile%-style paths. They have to be absolute paths
  • The articles show paths to a server, but local paths work fine.
  • You create a registry key under e.g. ...Common\Spotlight\Providers\MyCoolCategory
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.
  • Every time you change the xml configuration file, you need to refresh the Content\MyCoolCategory key just mentioned, and delete everything under it (or at least the MyCoolCategory key that relates to your changes). Even a machine reboot doesn't cause Visio to look again at the paths. So you'll be stuck with any errors until you delete Content\MyCoolCategory and force Visio to regenerate the info under that key.
  • You can use VSDs instead of VSTs, and Visio treats them just like templates (and opens unsaved copies.) If you are using this method to "install" your own custom templates, it is much easier to edit VSD files than VSTs (because you don't have to browse to a VSD and select "open original", you can just double-click the VSD file.)

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).
« Last Edit: November 13, 2014, 09:35:55 AM by Visio Guy »
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #6 on: November 13, 2014, 09:39:16 AM »
I should mention here what I usually do for customers, i.e. a THIRD way to "publish" content and custom templates:
  • Edit Visio's File Paths so that the templates path includes %userprofile%\Documents\MyShapes - the location where your Favorites stencil is.
  • I then add custom templates to this location, in addition to any stencils.
  • When Visio starts, it looks to the templates path and creates folders in the Start screen.

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.
« Last Edit: November 13, 2014, 09:41:20 AM by Visio Guy »
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Custom Templates XML (Start Screen/Deployment)
« Reply #7 on: November 13, 2014, 09:43:39 AM »
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.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010