Microsoft Word fields are used for documentation purposes, but many features throughout the program also use fields as their underlying implementation mechanism. A field includes distinct code and results areas where Word allows rich formatting and content.

Word marks and stores information for simple fields by means of the Span element with the mso-field-code style. The mso-field-code value represents the string value of the field code. Formatting in the original field code might be lost when saving as HTML if only the string value of the code is necessary for its calculation.

Word has a different way of storing field information to HTML for more complex fields, such as ones that have formatted text or long values. Word marks these fields with <!--[if supportFields]> so the data is not displayed in the browser. Word uses the Span element with the mso-element: field-begin, mso-element: field-separator, and mso-element: field-end attributes to contain the three respective parts of the field code: the field start, the separator between field code and field results, and the field end. Whenever possible, Word will save the field to HTML in the method that uses the least file space.

Binary data

For fields that consist of binary data, Word uses the Data element to contain the data.

Locked field results

To save the locked state of a field in HTML, Word uses a new mso-field-lock style attribute. The default value is no, so only yes is saved to HTML. For simple fields, mso-field-lock should be placed in the same Span element as the mso-field-code style attribute. In the case of advanced fields, it should be placed on the Span element that includes the mso-element: field-begin attribute.

For information about the style attributes that Office uses and their possible values, see the Style Attributes topic.