How do I? – Manage WSS Document Library Templates

OK, this post is specifically related to WSS 2.0.
If you've created document libraries before, you probably noticed the selection of a document type that is made in the last field, the Document Template field, on the creation form e.g.
The default is "Microsoft Office Word document".
Now you have your brand new document library and you decide to update the template. But how would you accomplish such a feat? This is where the Explorer View comes into play. The template is nothing more than a Word document, or whatever other type of document was specified.
  1. Navigate to your target document library.
  2. Notice how we don't have any visible folders in this library. The key here being "visible". In the "Select a View" menu pane on the left, click the "Explorer View" option.
  3. You should now see a "Forms" folder in the viewing pane on the right. This folder is only visible in Explorer View. Double click the "Forms" folder to open it.
  4. You should see 5 .aspx pages and a template file named "template.doc" in the viewer pane. The extension of the template file depends on the default document type that was selected during document library creation. In this case, the default option for Word document was used so the template file is called "template.doc". If an Excel document default was selected during library creation, the template file would be called "template.xls" as you can see below.
  5. To update the template, simply double click the "template.doc" file to open it. Edit the document until you are happy with the template and the save it, overwriting the version in the "Forms" library and thus updating your template for the given document library.

The question now become, what if you already have your template document? How do you get its content into the library template file? You could edit the library template file and do a copy and paste, but that would not be the best method to use. You would think that clicking the "Upload Document" button would allow you to upload your template replacement document to the "Forms" folder, but you'd be mistaken. All that would accomplish is to upload the document to the document library itself while the template document remains untouched. The easiest way is to use hotkeys…

  1. Navigate to the document library's Explorer View as previously described.
  2. Open Windows Explorer.
  3. Navigate to the folder in which your replacement template document is located.
  4. Select the replacement template document.
  5. Copy the document.
    TIP: You could use right click menus here, but in WSS you'll get a bunch of annoying warning dialogs so it's best to just use the Ctrl+C and Ctrl+V hotkeys instead.
  6. Go back to the document library Explorer View window and click anywhere in the viewing pane to set focus to it.
  7. Paste the replacement template document. You will be prompted to confirm that you wish to overwrite the existing template document.
  8. Click "Yes" to overwrite the template.

That brings up another question. What if I want to completely change the template type of the library? Say I want to change the library from a Word template to an Excel template. Would I just delete the "template.doc" and replace it with "template.xls"? The answer is not that simple. WSS stores it's link to the library template so you need to update that before your change would take effect.

  1. Upload your new template document as described above in the overwrite directions. The notable difference would be that you won't be prompted to confirm the overwrite of the template document because your new document would have a different extension. Upon completion, you will have two template documents.
  1. If you attempted to create a new document at this point, WSS will still generate a Word document. To remedy this, click the "Modify settings and columns" link in the left hand navigation pane.
  2. Under the "General Settings" section, click the "Change general settings" link.
  3. Scroll to the bottom of the page and in the "Document Template" option, note the Template URL.
  4. Modify this value to reflect the name of your new document template e.g. "template.xls" in our case.
  5. Click the "OK" button to commit the change. Now if you navigate back to the library and click the "New Document" button, it will create an Excel document from your template.

That brings us to one last point to note. You can have multiple document templates in the "Forms" library and can switch from time to time between these template as you wish but each library can only have one active template at a time. WSS 3.0 solves this with document type definitions but that's a story for another blog post.
One more thing to note is that WSS is intellengent enough to tie the document template file in the "Forms" folder to the "Document Template" setting for the library. That means that if you rename the document in the "Forms" library say from "template.doc" to "mytemplate.doc", WSS will automatically update the library setting to keep pointing to that document template file. That also means that if you were to delete the document template file, WSS would remove the template setting completely from the library thus having no default and NO, before you ask… it does NOT update the setting when you upload a new template file AFTER deleting the original template file. My advice is to just overwrite the template file instead…

Posted in

Post a Comment

Comments are moderated only for the purpose of keeping pesky spammers at bay.