I’m using a C# application which create .doc files from a template.
The problem is that I don’t keep the templates and, when the template file doesn’t exist anymore, the .doc file makes a very long time to open.
I’ve understood that Word try to find the template file before opening the doc file. It seems useless cause when Word opens the document (after a long time) it shows perfectly.
This is the code I use to open the file :
wordApplication = new Microsoft.Office.Interop.Word.Application();
wordApplication.Documents.Add("PATH TO DOC");
There is no problem if the template file exists but it takes a very long time if it do not.
Any idea on how to remove that “link” between the template and the doc created from the template ? (In C#)
You can use
set_AttachedTemplateof theWord.Documentobject to change the template.You might have to call
UpdateStyleson the document to copy over the style information from the new template.