Microsoft Excel tables export formatting
Sample script file: ExcelExport.mrs
This example script is based on the Museum sample data set. See
Running the sample table scripts for information on running the example scripts.
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 change 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 might prefer to export without using styles.
To use styles, select Use Excel styles in the Microsoft Excel Exports dialog.
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 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
|
Formats header and footer annotations
|
Variabletext
|
VariableTextTop
VariableTextSide
|
Formats variable names or descriptions in the table column headers
|
Elementtext
|
ElementTextTop
ElementTextSide
|
Formats category names or descriptions in the table row headers
|
Cell values
|
Values
|
Formats cell contents
|
The following diagram shows the styles used to format the various texts in a table.
Styles applied to texts in a table
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.
To select the styles option, set the UseExcelStyles export property to True:
TableDoc.Exports.mrExcelExport.Properties["UseExcelStyles"] = True
Applying a standard formatting to exported tables
To apply a standard formatting to exported tables (for example, because you have a house style), do the following:
1: Set up the formatting, and then save it in a “master document”
1 Export the tables using the UseExcelStyles export property Use Excel styles option.
2 In Excel, change the Excel Export styles to your requirements.
3 Save the Excel file.
2: Import the formatting to the exported files
1 Export the tables using the UseExcelStyles export property Use Excel styles option.
2 Open the master document that you set up in step 1.
3 Open the newly exported Excel workbook, and then click Format > Style.
4 Click Merge.
5 In the Merge styles dialog, 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.
Annotations
Annotations are displayed left aligned, regardless of the annotation positions selected. This means that in a wide table the annotations are easily visible. The following table shows the order in which the annotations are presented.
Headers | Footers |
---|
TitleHeader | TitleFooter |
LeftHeader | LeftFooter |
CenterHeader | CenterFooter |
RightHeader | RightFooter |
To suppress the annotations from the export, set the
DisplayAnnotations export property to False. See
Microsoft Excel tables export properties for more information.
Requirements
▪UNICOM Intelligence Reporter
▪Microsoft Office 2007 or later
See also