General Text Formatting Options
The Field dialog opens when you add a new merge field to a template. To open the dialog for an existing merge field, right-click the field and select Edit Field...
The following text formatting options can be set within Microsoft Word's Field dialog, or by entering formatting codes within the merge field:
- Uppercase
Displays the merge field's value in uppercase letters.
- Lowercase
Displays the merge field's value in lowercase letters.
- First capital
Capitalizes the first letter of the first word in the field.
- Title case
Capitalizes the first letter of each word in the field.
- Text Before
Inserts a specified phrase before the merge field value.
- Text After
Inserts a specified phrase after the merge field value.
The Field Dialog in Microsoft Word 2002 (XP)
To set a merge field's formatting to Uppercase, Lowercase, Title case, or First capital using the Field dialog:
- The Field dialog opens automatically when you insert a new merge field. If you are formatting an existing merge field, right-click the merge field and select Edit Field...
- From the Format list select a format. For example, select Uppercase.
To display text before and/or after a merge field value:
- The Field dialog opens automatically when you insert a new merge field. If you are formatting an existing merge field, right-click the merge field and select Edit Field...
- Check Text to be inserted before and/or Text to be inserted after.
- In the Text Before text box, enter a phrase to display before the merge field value, and/or, in the Text After text box, enter a phrase to display after the merge field value.
You can also set these formatting options by entering special codes in the merge field. To view and edit a merge field's codes, right-click the field and select Toggle Field Codes. A field without special formatting looks like this:
Format | Field Codes | Example |
---|---|---|
Uppercase | ||
Lowercase | ||
First capital | ||
Title case | ||
Text Before | ||
Text After |
Date and Time Formatting Options
Using field codes, you can apply date/time formatting to merge fields that will bind to database fields of types Date, Time, and Timestamp, or to an object of type System.DateTime. The general format for applying date/time codes is:
Date/Time Format Code | Description | Field Code Example | Output Example |
---|---|---|---|
Day | |||
d | Displays the day of the month as a number. Single digit day numbers will not include a leading zero. | 4/7/2003 | |
dd | Displays the day of the month as a number. Single digit day numbers will include a leading zero. | 07 April 2003 | |
ddd | Displays a three-letter abbreviation for the day of the week. | Mon, 7-Apr-03 | |
dddd | Displays the full name of the day of the week. | Monday, April 7, 2003 | |
Month (Use uppercase M for months, lowercase m for minutes) | |||
M | Displays the month as a number. Single digit month numbers will not include a leading zero. | 4/7/03 | |
MM | Displays the month as a number. Single digit month numbers will include a leading zero. | 2003-O4-07 | |
MMM | Displays a three-letter month abbreviation. | Apr-03 | |
MMMM | Displays the full month name | April 7, 2003 | |
Year | |||
yy | Displays a two-digit year number. For years 1-9, the year number will include a leading zero. | Apr-03 | |
yyyy | Displays a four digit year number | April 7, 2003 | |
Hours | |||
h | Use lowercase h to display times based on the 12-hour clock. Lowercase h displays single-digit hours as single-digit numbers, without a leading zero. | 6:05 | |
hh | Use lowercase hh to display times based on the 12-hour clock. Lowercase hh displays single-digit hours with a leading zero. | 06:05 am | |
H | Use uppercase H to display times based on the 24-hour clock. Uppercase H displays single-digit hours as single-digit numbers, without a leading zero. | 7:05 | |
HH | Use uppercase HH to display times based on the 24-hour clock. Uppercase HH displays single-digit hours with a leading zero. | 18:30 | |
Minutes (Use lowercase m for minutes, uppercase M for months) | |||
m | Displays single-digit minutes without a leading zero. | 2 minutes | |
mm | Displays single-digit minutes with a leading zero. | 06:05 am | |
AM & PM | |||
AM/PM | Displays uppercase AM or PM. | 08:30 PM | |
am/pm | Displays lowercase am or pm. | 07:55 am | |
Other Text | |||
'text' | To display text within a date or time, enclose the text in single quotation marks. | 06:15 EST | |
character | To include a character, such as - (hyphen), in a date or time, do not enclose in quotation marks. | Apr-03 |