How to make a form letter in microsoft word


















NET so I show the code for both in the examples and you can decide which language that you want to work in. The data source is a contiguous range of data in an Excel worksheet.

The data is a listing of addresses as shown in Figure 1. I retrieved the data from the workbook by using automation. For more information about this and other topics, see the Additional Resources section at the end of this column.

The project retrieves the worksheet data as a comma-delineated string and parses it into an array. A new document is then created from a template see Figure 2 and the main document part is opened and read into an XML document. Next, the first bookmark and its associated text nodes are retrieved based on the bookmark ID zero-based by using an XPath query. The code then iterates through one or more text nodes. A bookmark may contain data split across multiple text nodes depending on how the bookmark was created and modified.

For example, suppose that you insert a bookmark into a document by highlighting placeholder text, and adding the bookmark from the insert bookmark command on the Ribbon user interface. Then, you go back and edit the placeholder text. In all likelihood, the placeholder text is now contained across multiple text nodes. You must take multiple text nodes into consideration when updating bookmarks programmatically. When the code reaches the first text node, the associated piece of address data such as FirstName or Street is copied into it.

The code then continues iterating through the remaining text nodes, deleting each one so that the result is one text node per bookmark that contains the address text.

This process continues for each bookmark. And finally the XML is written back to the main document part and the process continues, assuming that there is another address in the queue.

The result for one address is shown in Figure 3. All of this is explained in more detail as you read through the commented code later in this column. In the following steps, you create the Excel workbook that contains the address data and the template document with bookmarks. On Sheet1 , add the addresses shown in Figure 1. Save the workbook as Test. On the Insert menu, click Bookmark. In the Bookmark name box, type Date, and click the Add.

Make sure that Fill-in enabled is selected, and then select OK. Note: To unprotect the form and continue editing, click Protect Form again. You can create the form with the desktop version of Word with the instructions in Create a fillable form. Show the Developer tab If the developer tab isn't displayed in the ribbon, see Show the Developer tab.

Open a template or a blank document on which to base the form To save time, start with a form template or start from scratch with a blank template. Select Blank document. Click or tap where you want to insert the control. A picture control is often used for templates, but you can also add a picture control to a form. Select Developer and content controls for the building block.

Select the content control, and then select Properties. Repeat this step until all of the choices are in the drop-down list. Fill in any other properties that you want.

Click or tap where you want to insert the date picker control. Click or tap where you want to insert the check box control.

Click or tap where you want to insert a legacy control. Open a template or use a blank document To create a form in Word that others can fill out, start with a template or document and add content controls.

In Search, type form. Double-click the template you want to use. In Save As , type a file name and then select Save. In the document, click or tap where you want to add a content control. To set specific properties for the control, select Options , and set.

Repeat steps 1 through 3 for each control that you want to add. Set common properties. Set specific properties for a Check box.

Set specific properties for a Combo box Drop-down item Type in strings for the list box items. If you want, you can test the form before you distribute it. Protect the form. Reopen the form, fill it out as the user would, and then save a copy. Show the Developer tab On the right side of the ribbon, select , and then select Ribbon Preferences.

Under Customize , select Developer. Open a template or a document on which to base the form You can start with a blank document and create your own form. Double-click the form template that you want to use. Add content controls to the form In the document, click where you want to add the control. Need more help? Expand your skills. Get new features first. Was this information helpful? That last option is useful if you need someone to type in a paragraph of text.

Plain-text controls do allow bold, font changes or color changes. If you need a drop down field added to your form go ahead and insert the drop down control. Highlight the field and again go to Properties to add your custom drop down options. By default, the Display Name and Value will be the same, but you can change it if you like. There really is no reason to change the value unless you are writing Word macros and refer to the controls in code. Hint: If your drop down field is not displaying make sure you are out of the Design Mode control.

The only difference between the dropdown list control and the combo box control is that the latter allows the user to enter their own value. The date picker control works just like any date picker you have probably used before. When you click on it, a calendar appears and you can simply click on the date to select it.

Picture Control allows the user to upload or insert an image file easily. For more tech tips like this, click here , or learn about our IT support services for businesses.

Every company has different networking and security challenges. Our assessment reviews your current setup, diagnoses risks, and offers solutions. Ten things you should know about an IT provider's managed services. See how the others stack up against IT Solutions. Download PDF.



0コメント

  • 1000 / 1000