Microsoft Office uses borders and shading to highlight text and graphics. For the most part, these visual effects are saved to HTML using standard HTML cascading style sheets (CSS) formats.
Microsoft Word allows the application of border and shading properties to text, paragraphs, sections, tables, and table cells. The following CSS style attributes correspond to Word formatting elements.
Attribute | Value in Word |
background-color | The shading fill behind the text or art. |
background | The shading fill of the object. |
border-style | The style of a border. |
border-width | The width of a border. |
border-color | The color of a border. |
padding | The distance between the text and the border. |
To preserve these effects, Word uses the following HTML style attributes. Note that each attribute has multiple values; for example, border-top uses a string to define the values (in order) of width, style, and color.
Style | Word property |
background | Fill color of the element. |
border-top | Width, style, and color of the top border. |
border-left | Width, style, and color of the left border. |
border-right | Width, style, and color of the right border. |
border-bottom | Width, style, and color of the bottom border. |
border | Width, style, and color of all borders. |
padding | The distance from each border side to the text within. |
Whenever the padding is not 0 (zero) for all four sides, the HTML padding attribute is generated for top, right, bottom, and left values (in that order, which is clockwise).
Padding is exported in absolute units.
Padding is stored in the mso-padding-alt attribute if the normal HTML padding attribute does not apply.
If all four sides have the same border attributes, then the Border element can be used instead of border-top, border-left, etc.
Border widths are in absolute units. Colors are defined by standard HTML colors (red, green, etc.) or color numbers (#nnnnnn).
If the border color is set to Auto in the interface, the CSS2 value of windowtext is used.
Word has 24 border styles; five of them map to standard CSS (none, single, double, dotted, and dashed). The rest are mapped using the mso-border-alt attribute. However, if a border style cannot be displayed, it will at least be preserved. For example, the wave border will not be displayed in HTML but it will be displayed when loaded back into Word.
Shadows are not displayed but are preserved with the mso-border-shadow attribute.
Shading is displayed in HTML and uses the mso-shading and mso-pattern attributes to generate simple pattern backgrounds. The pattern is not displayed, but the shading is.
Word can store a "fifth" border that is between two bordered enclosures. This value is stored in the mso-border-between attribute.
Page borders (used to define printed borders) are not displayed in a browser but are preserved in the mso-page-border-surround-header, mso-page-border-surround-footer, mso-border-aligned, mso-page-border-display, mso-page-border-offset-from, and mso-page-border-z-order attributes.
Borders are generated at three different levels. Values include:
Level | Storage |
text | Borders are stored using the Span element. |
paragraph | Borders are stored using the Paragraph element. |
document | Borders are stored using the Div element. |
Tables are exported to HTML tables whenever possible.
The mso-cellspacing attribute is used to make the size of the intercell gap persistent.
Microsoft Excel uses most of the same attributes and techniques as Word for borders and shading.
Excel uses the mso-background-source attribute with the UI value of Auto to store backgrounds that have the windowtext value.
Microsoft PowerPoint doesn't use borders and shading in the same manner as Word and Excel, since it uses VML to generate most of its design elements.