Exporting tables using Microsoft Excel styles
When you export tables to Microsoft Excel, you can choose whether to use styles to control the formatting. By default, the exported tables will look the same whether you use styles or not. However, styles make it easy to alter the look of your tables and apply standard formatting to multiple tables. If you want to use Excel to manipulate the data in the tables rather than printing them, you may prefer to export without using styles.
To use styles, click Use Excel styles in the Microsoft Excel Exports dialog box.
In Excel, each style has a name and defines a combination of formatting characteristics, such as font, font size, color, and emphasis, and indentation. 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 following table lists the styles that are used by the Excel export.
Style type
|
Style name
|
Description
|
Annotations
|
Footer
Header
|
Used to format header and footer annotations.
|
Variabletext
|
VariableTextTop
VariableTextSide
|
Used to format variable names or descriptions in the table column headers.
|
Elementtext
|
ElementTextTop
ElementTextSide
|
Used to format category names or descriptions in the table row headers.
|
Cell values
|
Values
|
Used to format cell contents.
|
The following diagram shows the styles used to format the various texts in a table.
Styles applied to texts in a table
Note The export does not apply borders to the exported tables using styles. However, you can switch borders on and off using the DisplayBorders export propertyDisplay borders option in the Exports dialog box.
To select the styles option, set the UseExcelStyles export property to True:
TableDoc.Exports.mrExcelExport.Properties["UseExcelStyles"] = True
Sometimes you may want to apply a standard formatting to your exported tables--for example, because you have a house style. You can do this in two steps:
To set up the formatting and save it in a "master document".
1 Export your tables using the UseExcelStyles export property Use Excel styles option.
2 In Excel, adjust the formatting of the Excel Export styles shown in the table above to suit your requirements.
3 Save the Excel file.
To import your formatting into your exported files
1 Export your tables using the UseExcelStyles export property Use Excel styles option.
2 Open the master document you set up in step 1.
3 Open the newly exported Excel workbook if not already open, and then choose Style on the Format menu.
4 Click Merge.
5 In the Merge styles dialog box, double-click the master document that contains the formatting you want to copy.
6 Choose Yes when you are prompted whether you want to merge the styles with the same names.
Headers and footers
All of the headers and footers are displayed left aligned, regardless of the positions selected in the Header and Footer dialog box. This has the advantage that in a wide table all of the headers and footers are easily visible. The following table shows the order in which the headers and footers are presented.
Headers | Footers |
---|
Title Header | Title Footer |
Left Header | Left Footer |
Center Header | Center Footer |
Right Header | Right Footer |
You can suppress the headers and footers from the export by deselecting the Headers and footers export option.
See also