Exporting to Microsoft Excel
The Excel rendering extension renders a report that is compatible with Microsoft Excel 97 and later. The report is exported to an Excel spreadsheet with some layout and original design elements stripped out as described in this topic. The format for reports rendered as Microsoft Excel is Binary Interchange File Format (BIFF). The content type of files generated by this renderer is: application/vnd.ms-excel. The file name extension of files generated by this renderer is: .xls.
When you define a parameter of type String, the user is presented with a text box that can take any value. If a report parameter is not tied to a query parameter and the parameter values are included in the report, it is possible for a report user to type expression syntax, script, or a URL into the parameter value, and render the report to Excel. If another user then views the report and clicks the rendered parameter contents, the user may inadvertently execute the malicious script or link.
To mitigate the risk of inadvertently running malicious scripts, open rendered reports only from trusted sources. For more information about securing reports, see Securing Reports and Resources.
Rectangles, subreports, the report body, and data regions are rendered as a range of Excel cells. Text boxes, images, and charts must be rendered within one Excel cell, which might be merged depending on the layout of the rest of the report.
Images, charts, and lines are positioned within one Excel cell but they sit on top of the cell grid. Lines are rendered as cell borders.
This renderer supports only logical page breaks. A new Excel worksheet tab is created for each explicitly defined logical page break.
If there is only one worksheet in the workbook, excluding the Document Map, the name of the worksheet is the report name.
If there are multiple worksheets in the workbook, excluding the Document Map, the worksheets are named SheetX, where X is the number of the sheet in the workbook, for example, the fifth worksheet in called Sheet5.
The Excel rendering extension uses the page height and width settings to determine what paper setting to define in the Excel worksheet. Excel tries to match the PageHeight and PageWidth property settings to one of the most common paper sizes.
If no matches are found, Excel uses the default page size for the printer. Orientation is set to Portrait if the page width is less than the page height; otherwise, orientation is set to Landscape.
Depending on the Device Information SimplePageHeaders setting, the page header can be rendered in two ways: the page header can be rendered at the top of each worksheet cell grid, or in the actual Excel worksheet header section. By default, the header is rendered to the cell grid on the Excel worksheet.
The page footer is always rendered to the actual Excel worksheet footer section, regardless of the value of the SimplePageHeaders setting.
Excel header and footer sections support a maximum of 256 characters, including markup. If this limit is exceeded, the Excel renderer removes markup characters starting at the end of the header and/or footer string to reduce the number of total characters. If all markup characters are removed and the length still exceeds the maximum, the string is truncated starting from the right.
By default, the Device Information SimplePageHeaders setting is set to False; therefore, the page headers are rendered as rows in the report on the Excel worksheet surface. The worksheet rows that contain the headers become locked rows. You can freeze or unfreeze the pane in Excel. If the Print Titles option is selected, these headers are automatically set to print on every worksheet page.
The page header repeats at the top of every worksheet in the workbook except the document map cover sheet if the Print Titles option is selected on the Page Layout tab in Excel. If the Print on first page or the Print on last page option is not selected in the Report Header Properties or Report Footer Properties dialog boxes, the header will not be added to the first or last page respectively.
Page footers are rendered in the Excel footer section.
Because of Excel limitations, text boxes are the only type of report item that can be rendered in the Excel header/footer section.
Some interactive elements are supported in Excel. The following is a description of specific behaviors.
Show and Hide
Microsoft Excel has limitations with how it manages hidden and displayed report items when they are exported. Groups, rows, and columns that contain report items that can be toggled are rendered as Excel outlines. Excel creates outlines that expand and collapse rows and columns across the entire row or column which can cause the collapse of report items that are not intended to be collapsed. In addition, Excel's outlining symbols can become cluttered with overlapping outlines. To address these issues, the following outlining rules are applied when using the Excel rendering extension:
The report item in the top-left corner that can be toggled can continue to be toggled in Excel. Report items that can be toggled and share vertical or horizontal space with the report item that can be toggled in the top-left corner cannot be toggled in Excel.
To determine whether a data region will be collapsible by rows or columns, the position of the report item that controls the toggling and the position of the report item that is toggled are determined. If the item controlling the toggling appears before the item to be toggled, the item is collapsible by rows. Otherwise, the item is collapsible by columns. If the item controlling the toggling appears beside and above the area to be toggled equally, the item is rendered with row collapsible by rows.
To determine where the subtotals are placed in the rendered report, the rendering extension examines the first instance of a dynamic member. If a peer static member appears immediately above it, the dynamic member is assumed to be the subtotals. Outlines are set to indicate that this is summary data. If there are no static siblings of a dynamic member, the first instance of the instance is the subtotal.
Due to an Excel limitation, outlines can be nested up to 7 levels only.
If any document map labels exist in the report, a document map is rendered. The document map is rendered as an Excel cover worksheet inserted at the first tab position in the workbook. The worksheet is named Document map.
The text displayed in the document map is determined by the report item's or group's DocumentMapLabel property. Document map labels are listed in the order that they appear in the report, starting at the first row, in the first column. Each document map label cell is indented the number of levels deep it appears in the report. Each level of indentation is represented by placing the label in a subsequent column. Excel supports up to 256 levels of outline nesting.
The document map outline is rendered as a collapsible Excel outline. The outline structure matches the nested structure of the document map. The expand and collapse state of the outline starts at the second level.
The root node of the map is the report name, the <reportname>.rdl, and it is not interactive. The document map links font is Arial, 10pt.
Drillthrough links that appear in text boxes are rendered as Excel hyperlinks in the cell in which the text is rendered. Drillthrough links for images and charts are rendered as Excel hyperlinks on the image when rendered. When clicked, the drillthrough link opens the client’s default browser and navigates to the HTML view of the target.
Hyperlinks that appear in text boxes are rendered as Excel hyperlinks in the cell in which the text is rendered. Hyperlinks for images and charts are rendered as Excel hyperlinks on the image when rendered. When clicked, the hyperlink opens the client’s default browser and navigates to the target URL.
Excel does not support interactive sort.
Bookmark links in text boxes are rendered as Excel hyperlinks in the cell in which the text is rendered. Bookmark links for images and charts are rendered as Excel hyperlinks on the image when rendered. When clicked, the bookmark goes to the Excel cell in which the bookmarked report item is rendered.
The following is a brief description of how items are rendered in Excel.
Excel supports a palette of up to 56 colors. The first 56 unique colors used in the report are defined in a custom palette. If more than 56 colors are used in the report, the rendering extension matches the required color to one of the 56 colors already available in the palette. Excel’s color matching algorithm is used to match colors to ones already existing in the palette.
Excel places limitations on exported reports due to the BIFF's format capabilities. The most significant are the following:
The maximum number of rows in a worksheet is limited to 65,536. If this is exceeded, the renderer displays an error message.
The maximum number of columns in a worksheet is limited to 256. If this is exceeded, the renderer displays an error message.
The maximum column width is limited to 255 characters or 1726.5 points. The renderer does not verify that the column width is less than the limit.
The maximum row height is 409 points. If the contents of the row cause the row height to increase beyond 409 points, the contents are split and added to the next row instead.
The maximum number of characters in a cell is limited to 32,767. If this is exceeded, the renderer displays an error message.
Approximately 1000 characters are displayed in an Excel cell on the worksheet but up to the maximum number of characters can be edited in the formula bar.
The maximum number of worksheets is not defined in Excel, but external factors, such as memory and disk space, might causes limitations to be applied.
Text box values that are expressions are not converted to Excel formulas. The value of each text box is evaluated during report processing. The evaluated expression is exported as the contents of each Excel cell.
If cells are merged, word-wrap does not work correctly. If any merged cells exist on a row where a text box is rendered with the AutoSize property, autosize will not work.
Background images for report items are ignored because Excel does not support background images for individual cells.
Text boxes are rendered within one Excel cell. Font size, font face, decoration, and font style are the only formatting that is supported on individual text within an Excel cell.
The text effect "Overline" is not supported in Excel.
Excel headers and footers support a maximum of 256 characters including markup. The rendering extension truncates the string at 256 characters.
In outlines, Excel permits up to seven nested levels only.
If the report item that controls whether another item is toggled is not in the previous or next row or column of the item being toggled, the outline is disabled also.
The Excel rendering extension only supports the background image of the report body. If a report body background image is displayed in the report, the image is rendered as a worksheet background image.
Excel adds a default padding of approximately 3.75 points to the left and right sides of cells. If a text box’s padding settings are less than 3.75 points and is just barely wide enough to accommodate the text, the text may wrap in Excel.
To work around this issue, increase the width of the text box in the report.
You can change some default settings for this renderer by changing the device information settings. For more information, see Reporting Services Device Information Settings.