O'Reilly logo

Office 2003 XML by Evan Lenz, Mary McRae, Simon St. Laurent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

More on Styles

Having come this far in the chapter, you should already know a few key aspects of how styles work in Word and WordprocessingML:

  • A style is a grouping of property settings that can be applied as a unit.

  • There are four kinds of styles: paragraph, character, table, and list.

  • Styles are defined using w:style elements inside a WordprocessingML document’s w:styles element.

  • Paragraphs, runs, and tables can be directly associated with a style of the appropriate kind through the w:pStyle, w:rStyle, and w:tblStyle elements, respectively.

You should also know the basic syntax of the w:style element, and four aspects in particular:

  • The w:type attribute, indicating the type of style defined here (paragraph, character, table, or list)

  • The w:default attribute, indicating whether this style is the default style for its type

  • The w:styleId attribute for intra-document references to this style

  • The w:name element, indicating the style’s primary name as exposed in the Word UI

In this section, we’ll look at a few more aspects of how styles are defined, how default styles work (or don’t), how to derive styles, and how style conflicts are resolved.

A Document’s Styles

All styles that are used within a document must also be defined in the document. This effectively means that you can’t leverage Word’s built-in styles outside of Word; i.e., you can’t simply refer to them by name. When a document uses a built-in Word style, Word makes a copy of the built-in style, rather than merely a reference ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required