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 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, choose the Use Excel styles option 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 that 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:
1: 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.
2: 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.
Annotations
All of the annotations are displayed left aligned, regardless of the annotation positions selected. This has the advantage 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 |
You can suppress the annotations from the export by setting 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