Desktop User Guides > Professional > Table scripting > Exporting tables > Microsoft Word tables export > Formatting the output in Microsoft Word > Working with Microsoft Word styles
 
Working with Microsoft Word styles
The Microsoft Word export uses a number of paragraph styles to format different types of text. You can change the appearance of the various texts by changing the styles. You can do this in the template or in the Word document itself. Working in the template has the advantage that the styles can be used in multiple documents.
In Word, each paragraph style has a name and defines a combination of formatting characteristics, such as font, font size, color, and emphasis, and text alignment, indentation, and spacing. When you apply a specified style to an item, all of the formatting that is stored in that style is automatically applied to the item. By changing the formatting defined for a style, you can quickly change the formatting of all of the items to which the style has been applied.
The custom styles used by the Word export fall into four groups:
Annotation. Controls the formatting of the headers and footers annotations.
Axis. Controls the formatting of the row and column heading texts.
Cell. Controls the formatting of the cell contents.
Survey. Controls the formatting of the project and table document descriptions shown as a document title, typically on the front page.
In the default template the base style in each group of styles is based on the Normal paragraph style. This means you can change, for example, the base font in all of the tables that have been exported using the default template, by simply changing the font in the template's Normal paragraph style. In addition all of the other styles within each group are in turn based on the previous style within the group. This makes it easy to change the formatting of all of the styles in a group.
The names of all of the styles in the Axis group start with "Axis", the names of the styles in the Cell group start with "Cell", and the names of the styles in the Survey group start with "Survey". When formatting a text, the export searches the appropriate group of styles for the closest matching style. If there is no suitable style in the style group, the Normal style is used.
The table of contents in the Word document is compiled from any text that is formatted in a style based on Word’s heading styles (Heading 1, Heading 2, Heading 3). In the default template, the only style that this applies to is the Annotation LeftHeader style, which is based on the Header 1 style. This means that all text in the left header annotation is included in the table of contents. All other annotation styles are based on the Annotation style and do not appear in the table of contents.
The easiest way to understand how it works is to create some tables of different types and export them to Word using the default template, and then examine the styles that are applied to the different texts. An easy way to find out which style is applied to a text is to use the Formatting toolbar. When you click in text in Word, the style that is applied to the text is shown in the Styles box on the Formatting toolbar.
If the Styles box is not shown on the Formatting toolbar, you can add it using the Customize dialog: click Tools > Customize. Then select the Commands tab and drag the Styles category to the toolbar. You can enlarge the Styles box by dragging the border.
The following diagram shows the default styles that are applied to a table of Age by Gender that has one item of cell contents (counts) and a mean element in the side axis.
Word table with default styles
This graphic is described in the surrounding text.
Three different styles are used for the cell contents--Cell TopBottom Base Count, Cell TopBottom Category Count, and Cell TopBottom and that all three of these styles are in the Cell group:
The Cell TopBottom Base Count style is the closest match for the cell contents in the cells formed from the base elements. The TopBottom subgroup is used because there is only one item of cell contents, the Base subgroup is used because the cells are formed from a base element, and the Count subgroup is used because the cell contents are counts.
A similar logic governs the choice of the Cell TopBottom Category Count style for the cell contents in the cells formed from the category elements.
The Cell TopBottom style is the closest match for the cells formed from the mean element because there is no Cell TopBottom Mean style in the default template.
If you want to define special formatting for the cells formed from the mean element, you would create a new style called Cell TopBottom Mean if you want it to apply to all cell content types or Cell TopBottom Mean Count if you want it to apply to counts only. You need to create the new style in a template and export the tables again using that template before the new style will be applied.
Similar rules govern the styles that control the formatting of the row and column headings. See Default Microsoft Word export styles for more information.
Unlike when using a cascading stylesheet in HTML, in Word you can apply only one paragraph style to an item.
See also
Formatting the output in Microsoft Word