Create a Folder on Your Desktop in Microsoft Windows. Your cursor will be automatically placed inside the folder name, so you can immediately type. Outlook®, PowerPoint®, Word® are registered trademarks of the Microsoft Corporation. Create a Drop-down List. You cannot simply copy and paste a cell with drop down list from Excel worksheet to your Word. Instead, you need add items to the drop-down form field in Word, so that you will be able to select one of the options from that field. In this section, we will specify how to do it. Head to “File” menu, and click on.
If you frequently create documents that contain the same specialized formatting, but not the same text, automate the process and save yourself a considerable amount of time by creating a template in Word. Examples include invoices, packing slips, and form letters.
Instructions in this article apply to Word 2019, 2016, 2013, 2007, 2003; and Word for Office 365.
What Is a Template?
A Microsoft Word template is a Word document that includes specific formatting, such as boilerplate text, macros, and headers and footers, as well as custom dictionaries, toolbars, and AutoText entries. These elements are there every time you open the template, and cannot be changed even when you change the document text. You can open the template as many times as you like.
Planning a Word Template
Before you create your Word template, create a list of features you want to include in it. The time you spend planning will save you time and hassle later.
Here are some suggestions for what to include:
- Text that is always included in the document.
- Formatting like columns, margins, tab stops, endnotes, and footnotes.
- Macros to automate tasks.
- A date field that updates automatically each time the template is opened.
- Address and contact information.
- Fields or AutoText for information that changes such as the page number, document title, or file path in headers and footers.
- Placeholder text with specific formatting such as typeface size. Consider using descriptive words such as TITLE or INTRO as placeholders.
Once you have an outline of all your template elements, create the prototype in a blank Word document. Include the elements you listed, and make appropriate adjustments.
Save Your New Template
After you finish creating the prototype for your template, save the document as a template.
For Word 2019, 2016, 2013, and 2010
To save a Word document as a Word template:
- Go to File.
- Select Save As.
- In the Save As dialog box, in the File name text box, type a descriptive template filename.
- Select the Save as type dropdown arrow and choose Word Template.
- The file path changes to the default template location. Templates in this folder appear in the Templates dialog box when you create a new document from a template. However, you can choose another folder if you want to.
- Select Save.
For Word 2007
To save a Word document as a Word template:
- Select the Microsoft Office button.
- Choose Save As > Word Template.
- In the Save As dialog box, to save the template in the default template folder, under Favorite Links select Templates. This is the recommended folder because templates in this folder appear in the Templates dialog box when you create a new document based on a template. However, you can navigate to another folder if you want to.
- In the File name text box, type a descriptive name for the template.
- Select Save.
For Word 2003
To save a Word document as a Word template:
- Select File > Save As.
- In the Save As dialog box, in the File name text box, type a recognizable name for the template.
- Select the Save as type dropdown arrow and choose Document Template.
- The file path changes to the default template location. This is the recommended folder because the templates in this folder appear in the Templates dialog box when you create a new document based on a template. However, you can navigate to another folder if you want to.
- Select Save.
Your document is now saved as a template with the file extension .dot or .dotx and can be used to generate new documents based on it.
-->This topic shows how to use the classes in the Open XML SDK 2.5 forOffice to programmatically create a word processing document.
![Word Word](/uploads/1/2/6/2/126263121/404950226.gif)
The following assembly directives are required to compile the code inthis topic.
Creating a WordprocessingDocument Object
In the Open XML SDK, the WordprocessingDocument class represents aWord document package. To create a Word document, you create an instanceof the WordprocessingDocument class andpopulate it with parts. At a minimum, the document must have a maindocument part that serves as a container for the main text of thedocument. The text is represented in the package as XML usingWordprocessingML markup.
To create the class instance you call the Create(String, WordprocessingDocumentType)method. Several Create() methods are provided, each with adifferent signature. The sample code in this topic uses the Create method with a signature that requires twoparameters. The first parameter takes a full path string that representsthe document that you want to create. The second parameter is a memberof the WordprocessingDocumentType enumeration.This parameter represents the type of document. For example, there is adifferent member of the WordProcessingDocumentType enumeration for eachof document, template, and the macro enabled variety of document andtemplate.
Note
Carefully select the appropriate WordProcessingDocumentType and verify that the persisted file has the correct, matching file extension. If the >WordProcessingDocumentType does not match the file extension, an error occurs when you open the file in Microsoft Word.
The code that calls the Create method ispart of a using statement followed by abracketed block, as shown in the following code example.
The using statement provides a recommendedalternative to the typical .Create, .Save, .Close sequence. It ensuresthat the Dispose () method (internal methodused by the Open XML SDK to clean up resources) is automatically calledwhen the closing bracket is reached. The block that follows the using statement establishes a scope for theobject that is created or named in the using statement, in this case wordDocument. Because the WordprocessingDocument class in the Open XML SDKautomatically saves and closes the object as part of its System.IDisposable implementation, and becauseDispose is automatically called when youexit the bracketed block, you do not have to explicitly call Save and Close─aslong as you use using.
Once you have created the Word document package, you can add parts toit. To add the main document part you call the AddMainDocumentPart() method of the WordprocessingDocument class. Having done that,you can set about adding the document structure and text.
Structure of a WordProcessingML Document
The basic document structure of a WordProcessingML document consists ofthe document and body elements, followed by one or more blocklevel elements such as p, which representsa paragraph. A paragraph contains one or more r elements. The rstands for run, which is a region of text with a common set ofproperties, such as formatting. A run contains one or more t elements. The telement contains a range of text. The WordprocessingML markup for thedocument that the sample code creates is shown in the following codeexample.
Using the Open XML SDK 2.5, you can create document structure andcontent using strongly-typed classes that correspond to WordprocessingMLelements. You can find these classes in the DocumentFormat.OpenXml.Wordprocessingnamespace. The following table lists the class names of the classes thatcorrespond to the document, body, p, r, and t elements.
WordprocessingML Element | Open XML SDK 2.5 Class | Description |
---|---|---|
document | Document | The root element for the main document part. |
body | Body | The container for the block level structures such as paragraphs, tables, annotations, and others specified in the ISO/IEC 29500 specification. |
p | Paragraph | A paragraph. |
r | Run | A run. |
t | Text | A range of text. |
Generating the WordprocessingML Markup
To create the basic document structure using the Open XML SDK, youinstantiate the Document class, assign itto the Document property of the maindocument part, and then add instances of the Body, Paragraph,Run and Textclasses. This is shown in the sample code listing, and does the work ofgenerating the required WordprocessingML markup. While the code in thesample listing calls the AppendChild methodof each class, you can sometimes make code shorter and easier to read byusing the technique shown in the following code example.
Sample Code
The CreateWordprocessingDocument method canbe used to create a basic Word document. You call it by passing a fullpath as the only parameter. The following code example creates theInvoice.docx file in the Public Documents folder.
The file extension, .docx, matches the type of file specified by theWordprocessingDocumentType.Documentparameter in the call to the Create method.
Following is the complete code example in both C# and Visual Basic.