Word Template Project Template
The features in this topic are available only if you have the required applications installed.
For more information, see.
The Word Template project template in Visual Basic and Visual C# provides the groundwork for applications that target new or existing Microsoft Office Word 2003 templates. The template automatically adds the necessary project references, files, and basic code to use as a starting point for your application.
Word templates that reference managed code extensions cannot be used as global add-ins. The assembly is not called if the template is loaded from the Startup directory of Word. For more information, see.
Some of the files and references listed below are hidden by default. To see them, click Show All Files on Solution Explorer.
There are some files and references not listed below that are common to many Visual Studio project templates.
If you open a template to edit it outside of Visual Studio after the solution has been compiled, the template will run the code just as if you had created a new document from the template. Depending on the code, this could alter the template while it opens, before you begin to edit. To prevent the code from running, hold down the SHIFT key while you open the template.
The following methods are included in the project template code file.
Startup is called after the document is running and all the initialization code in the assembly has been run. It is the last thing to run in the constructor of the class that your code is running in.
Shutdown is called when the application domain that your code is loaded in is about to unload. It is the last thing to be called in the class as it unloads.
These are the main user files. They are visible by default.
You cannot add additional classes to the code file behind a document, workbook, or worksheet. You must add new files to your project to contain any classes you want to write.
WordTemplate1.dot - Represents the Word template in a project. Contains the document design surface and the code file.
ThisDocument (.vb file for Visual Basic or .cs file for Visual C#) - A document that provides the design surface and the code file. For more information, see.
Microsoft Visual Studio 2005 Tools for the Microsoft Office System generates these hidden files. Do not modify these files manually; they are regenerated when changes are made to the project and they do not retain manual modifications.
.Designer.xml - A read-only declarative representation of the programmable objects in the document.
.Designer (.vb file for Visual Basic or .cs file for Visual C#) - A read-only code file that provides helper implementations, including code to instantiate objects correctly.
<Document Name>.Designer.xml - A read-only declarative representation of programmable objects such as custom controls that are not a part of Visual Studio Tools for Office by default.
<Document Name>.Designer (.vb file for Visual Basic or .cs file for Visual C#) - A read-only code file that provides helper implementations for custom controls.
Microsoft.Office.Core - The primary interop assembly for shared Office components.
Microsoft.Office.Tools.Common - A collection of helper implementations for developing actions pane and smart tags solutions.
Microsoft.Office.Interop.Word - The primary interop assembly for Word.
Microsoft.Office.Tools.Word - Implementations of Word controls and managed controls.
Microsoft.VisualStudio.Tools.Applications.Runtime - The component that loads the main project assembly in Word.
Microsoft .NET Framework assemblies - A collection of references to some of the Microsoft .NET Framework assemblies that are used when developing Visual Studio Tools for Office solutions.