output can be produced in a variety of Web-, page-, and
desktop-compatible formats. You cannot edit these files using the
Reporting Services tools, but third-party products are available to fit
this need. Each format has specific options and properties that
configure the rendering extension. The same extensions are used on the
report server, the Report Designer environment, and the ReportViewer control.
HTML is the default
rendering extension. It produces UTF-8 encoded pages or fragments.
Standard HTML 4.0 is produced by Report Manager, SharePoint Web parts,
and direct URL access. HTML 3.2 is possible only through URL addressing
with the rs:Format=HTML3.2 option. MHTML is also available through URL
addressing and the Export option in Report Manager. This format,
referred to as Web Archive, combines the graphics and report data into a
All report data
regions are rendered as tables. Charts become images. Style properties
turn into CSS style tags. Report-level items such as headers and footers
become HTML <DIV> tags.
rendering extension creates BIFF files that are compatible with Excel 97
and later. Each page in the report generates a worksheet in the Excel
file, as shown in Figure 4.
The data is stored in tabular format with nesting. Some colors are not
supported, so substitutions are made. Limitations exist for worksheet,
row, cell, and column sizes, so very large reports can be problematic.
Charts turn into pictures and are not editable Excel chart objects.
Document maps are rendered as the first worksheet with links to other
Figure 4. Report output in Excel format
The PDF rendering extension produces PDF 1.3–compatible output, as shown in Figure 5.
These files are suitable for viewers such as Adobe Acrobat. Bookmarks
are supported and turn into PDF bookmarks. Avoid drillthrough links—use
hyperlinks instead. Make sure that all fonts necessary to view the
report are installed on the report server as well as on the target
Figure 5. Report output in PDF format
The Image rendering
extension creates a bitmap or metafile. The default format is TIFF,
which stores multiple pages in a single file. Other available formats
include valid GDI+ variants: GIF, JPEG, PNG, BMP, and EMF. Size,
resolution, and image format are configurable. Items are rendered in the
order that they appear in the report definition. You can control this
by setting the zindex property of select objects.
Value (CSV) rendering extension produces plain-text files with no
character formatting or graphics. This is useful for importing into
other applications, such as spreadsheets and databases. The first row
contains field names by default. All data regions are output with a
column for each data element. This extension ignores such items as
headers, footers, images, and ActiveX controls. Field, record,
qualifier, and header settings are configurable.
XML rendering extension creates XML documents that are specific to the
source report. Layout and images are ignored. XML is useful in
application integration scenarios. The top-level element in XML is
Report. Each data region creates an element. The elements and attributes
are generated in the order that they appear in the report definition,
as shown in Figure 6. Data types are notated in the included schema. You can set element names by using the DataElementName property of individual objects in Report Designer or by using raw RDL.
Figure 6. Report output in XML format when viewed in Internet Explorer
The rendered XML
can be transformed using an XSLT document that you specify in URL
addressing. This is a creative and efficient way to produce custom
output formats. The result can be a more complex XML document, XHTML, or
plain text. Note that each report creates unique XML output, so the
XSLT transforms are specific to that report.
One uses ASP.NET Web pages to host links and iframes for URL access.
Another incorporates the ReportViewer
control in both ASP.NET pages and Windows Forms. The third is a useful
utility that combines Web service functionality with rendering to create
a report file generation factory.
Parameterized URL Access
One project in the Chap21 solution, CS Web Pages, includes a URLAccess.ASPX page that demonstrates URL access, as shown in Figure 7.
Figure 7. URL access inside a Web Page using an IFrame tag
In design view, you see a hyperlink (<A> tag) that opens a new page with the Tabular report. The URL phrase is shown here:
In this example, localhost is the server name and reportserver indicates the Web service virtual directory. The path and report are the first URL parameters. The rs:Command parameter instructs report server to render the report. Several rs: and rc: parameter options were described earlier.
The Chart Report button on the Web page has an onclick event handler that sets the src property of an iframe. This causes the chart sample to appear on demand.
The ReportViewer control is part of the .NET Framework 2.0. You can use it in ASP.NET pages as well as Windows Forms, as shown earlier in Figures 21-36 and 21-37.
The ASP.NET project called CS Web Pages has a page called
ReportViewer.aspx that embeds this control. The properties of the
control have a ProcessingMode that defaults to Local. Choose Remote, and use the Smart Tag
control to set the Report Server URL and Report Path. The Toolbar
category in the Properties window has options that control the toolbar
display. No code is needed for the report to display at runtime.
The project CS Forms has a form called Simple.cs. This form embeds a ReportViewer control with the Dock property set to fill. You use the Smart Tag
control or Properties windows to adjust the settings. Notice that the
report properties are identical in the Web and form versions. Adding
this control to the form automatically generates the necessary lines of
private void Simple_Load(object sender, EventArgs e)
Another sample form,
called Service.cs, uses the report server Web service to enumerate
folder and report names in a list box. Selecting a list item triggers
the SelectedIndexChanged event, which sets the ReportViewer ReportPath property and calls RefreshReport, as shown in the following code block:
public partial class Service : Form
ReportingService2005 rptSrvr = new ReportingService2005();
private void Service_Load(object sender, EventArgs e)
rptSrvr.Credentials = System.Net.CredentialCache.DefaultCredentials;
rptSrvr.Url = "http://localhost/reportserver/reportservice2005.asmx";
catItem = rptSrvr.ListChildren("/Chap21/reports", true);
foreach (CatalogItem item in catItem)
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
ReportViewer1.ServerReport.ReportPath = catItem[ListBox1.SelectedIndex].Path;
report server Web service can render reports in several output formats.
A CS Forms project called Render.cs combines the folder navigation
methods with a Treeview
control to display the folder hierarchy. The option button in the middle of the form
determines the output format. Enter a file name, and use FolderBrowserDialog
to select a target file folder. The Generate button renders the report
using the Web service and redirects the byte stream to the target file.
This utility can quickly generate sample output for testing purposes.
The code can easily be edited to automate other report generation tasks.