SharePoint Stuff

A collection of helpful tips and resources on maximising the value from a SharePoint Portal Server and Windows SharePoint Services Implementation.

Monday, March 13, 2006

.dot templates in SharePoint Document Library

If you upload a Word template (.dot) files into a SharePoint document library, and open it in Word, you will notice Word lets you overwrite the template, rather than create an Untitled Document.

When you select a .dot file in Word's File Open dialog box, Word will simply open the file, not use it as a new file template. Word uses .dot files for templates only when the .dot file is selected from within the File -> New -> From Template dialog box.

So when you click on a document in SharePoint, SharePoint assumes you want to edit it and is similar to opening it using File -> Open; and not File -> New.

21 Comments:

At 12:34 AM, Anonymous Anonymous said...

So, how do you get around this?

 
At 4:57 AM, Anonymous Anonymous said...

Exactly.. it's not really bright to add an article when you do not even tell how to correct it.

 
At 1:57 PM, Anonymous Anonymous said...

yeah, brilliant dumbass. Thanks for stating the obvious and sharing it with the worl.

 
At 8:48 PM, Anonymous Anonymous said...

I am having some problems also, i placed a dot file in mine libraries but when I open this one sharepoint opens the file as .dot file and not as a word file.
Any solutions..?

 
At 12:46 AM, Blogger Bjorn_E_AA said...

Hi, do you have a soultion for this problem?
(sharepoint opens the file as .dot file and not as a word file.)


Best regards

Bjoern Aanstad

 
At 1:01 AM, Anonymous Anonymous said...

I got around this by creating document libraries solely for template files (.dot, .xlt, .ppt, etc.) and set the default view to Explorer View. Now when users click on a template, it opens a new document based on the template. I also restricted editing of these libraries to a few people in the organization.

 
At 4:26 PM, Anonymous Anonymous said...

This is the worst blog ever! Is there anybody out there, who has (more) information how to solve this problem?

 
At 3:15 AM, Anonymous Anonymous said...

The only people who are ever going to find this blog are the people [like me] who have searched for a solution to this problem.
Grr! What a waste of space/time.

 
At 1:50 AM, Anonymous Anonymous said...

Why don't you point out that the sky is blue and grass is green? At least that is somewhat helpfull to the colour blind.

 
At 7:40 PM, Anonymous Anonymous said...

Add the .dot as the template for your library.

If you have content types enabled, add it as the template for your document type and add the document type to the library.

Then when you use the New menu, it will create a .doc instead of a .dot.

 
At 2:14 AM, Anonymous Anonymous said...

Stop bullying. Write something yourselves instead...

 
At 10:27 AM, Blogger Wardrop said...

This comment has been removed by the author.

 
At 10:30 AM, Blogger Wardrop said...

First of all, I feel sorry for anyone who is forced to work SharePoint.

I was tasked to find a work around to this problem at my place of work, and after a day of attacking it from various fronts, I came up with a simple javascript solution. Assuming you jquery 1.2 (or later) in your LAYOUTS folder with the name "jquery.min.js", you can paste the following source code into a content editor web part on the page (or pages) you wish to apply the fix.

<script type="text/javascript" src="/_layouts/jquery.min.js"></script>
<script type="text/javascript">
$( function () {
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
saveLocation = $(this).attr("href").split("/").slice(0, -2).join("/")
createNewDocumentWithProgID(window.location.protocol + '//' + window.location.host + $(this).attr("href"), window.location.protocol + '//' + window.location.host + saveLocation, 'SharePoint.OpenDocuments', false)
return false
})
})
</script>

This code snippet scans the page for links referencing .dot, .dotx, .xlt, or .xltx files. For each link found, it overrides the "onclick" behaviour. The default save location is set to next directory up from the documents own parent directory (as normally you don't want to save documents in the same location as the templates they're based on).

The secret sauce is the createNewDocumentWithProgID() javascript method; this is the method that the "New"/"New Document" menu uses to generate new documents from templates. The method takes a url to an office template (word, excel, etc) and a url to the default save location.

Anyone with experience with JavaScript can easily craft their own solution. You may even want to put this JS in the websites master page so the fix applies globally.

Cheers,
Tom

 
At 10:42 AM, Blogger Wardrop said...

I forgot to mention that this works with SharePoint 2007, and although I haven't tried it with SharePoint 2010, it should still work as I believe the createNewDocumentWithProgID() method is in 2010 also.

 
At 1:32 AM, Anonymous Melanie said...

What a genius piece of code - it worked like a dream and saved me hours of frustration! Thank you.

 
At 10:13 PM, Anonymous Anonymous said...

Great code. Thank you!

 
At 6:20 PM, Blogger Unknown said...

That code is pure genius, but it needs to be modified slightly to add .dotm and .xltm extensions for macro enabled templates. There is also some additional info here: http://marriedtosharepoint.com/2012/02/04/need-a-link-to-create-a-new-document-from-an-office-template/

 
At 6:24 PM, Anonymous Anonymous said...

Some good solutions to the problem here I like the explorer view and contenttype solutions, I am a configurator not a developer but the script is a great solution but it is harder to maintain custom solutions.

 
At 12:31 PM, Anonymous Anonymous said...

I had a similar issue where I wanted sharepoint to use a .dot file on a UNC / shared drive. This was a nightmare until I found this article, wher you link to a .lnk file that points to the .dot file on the \\shared\drive


so simple

http://support.microsoft.com/kb/278627/en-us

 
At 5:56 PM, Anonymous Anonymous said...

Tom, I tried it with SharePoint 2013 and works like clock work ... I like you :D

 
At 10:59 AM, Anonymous Anonymous said...

I am a novice with JaveScript. I pasted the code into NotePad and saved it with a file extension ".js" and then put that file in my site assets library. Then on my home page I added a Content Editor web part which links to that ".js" file in site assets. I must be missing something. Any ideas?
Thank you

 

Post a Comment

<< Home