MicrosoftВ® SQL Server(TM) 2005 Reporting Services Step by Step (Step by Step (Microsoft))

Most of the export or rendering formats provided by Reporting Services are presentation formats. They are intended to reproduce, as faithfully as possible, the format and the interactivity of your report as it appears in the preview format. The degree to which each presentation format can duplicate these things depends, in large part, on the features available in and the limitations of the viewer used by each format. For instance, a TIFF image viewer does not provide any hyperlinks, so the TIFF export does not support the navigation features.

In this section, we look at the viewer required to display each format. Also, the features supported and the features not supported by each presentation format are listed. We also discuss how each presentation format can best be utilized.

We use the RenderingTest report from the Chapter09 report project to examine some of the features supported by each presentation format. As mentioned earlier, you may download this report project from the website for this book if you want to perform the exports and make the comparisons yourself. Our standard is the appearance and behavior of this report in the Preview tab in the Report Designer. The top of the first page of the RenderingTest report in the Preview tab is shown in Figure 9–3. As we look at each presentation format, we can compare it to the way the report looks in this figure.

Figure 9–3: The RenderingTest report in the Preview tab

Note, I used a font called Juice ITC for the text box containing the words “Centered Text in a Fancy Font.” This was done to demonstrate the behavior of a font that may not be available on other computers. However, because of this, you may not actually see a fancy font in this text box. Instead, you see the font the Report Designer chooses to substitute for the requested font, which is unavailable. If this is the case, you have to trust the text and the figures to show you the behavior of this text box.

Note, too, the preview format does not pay strict attention to the physical page size specified for the report. The preview format allows a page to grow wider than a report page. The preview format does create page breaks based on the length of the page, but it does this only as an approximation. It does not strictly adhere to the page size specified for the report. Therefore, the page breaks found in the preview format differ from the page breaks found in formats that exactly follow the size properties of the report.

TIFF Image Presentation Format

TIFF is an acronym for Tagged Image File Format. TIFF is a file standard for storing images on personal computers, similar to the BMP and PCX formats. Unlike these formats, a TIFF file can store a number of images as multiple pages of a single document. This feature makes TIFF a popular format for storing fax documents.

When a report is rendered to a TIFF file, each page of the report is converted to a bitmap image. When we view the image, we see letters and numbers. However, the TIFF file itself contains only a series of dots. Because the entire report is stored as a bitmap image, TIFF files tend to be rather large.

Viewing TIFF Documents

On most Windows systems, TIFF files can be viewed using the Windows Picture and Fax Viewer. The Windows Picture and Fax Viewer has features for moving between pages, printing, and zooming in and out. This viewer also enables you to add annotations, including highlighting, drawing, text, and “sticky notes,” as shown in Figure 9–4. These annotations can be helpful if reports are distributed electronically while they are being analyzed.

Figure 9–4: The Windows Picture and Fax Viewer with on annotated report

If you do not have the Windows Picture and Fax Viewer available, TIFF viewers are available for nearly any personal computer platform. In many cases, a TIFF viewer can be obtained for a minimal charge as shareware or freeware. Note, not all TIFF viewers include the annotation features found in the Windows Picture and Fax Viewer.

Features Supported by the TIFF Format

The top of the first page of the RenderingTest report exported to a TIFF file is shown in Figure 9–5. As you can see, the TIFF image provides a faithful representation of the report as it is seen in the preview layout. It includes colors, images (including background images), and charts. It preserves strings of text, including embedded new lines and multiple spaces in a row. (You soon see this causes a problem in another file format.)

Figure 9–5: The RenderingTest report exported to a TIFF file

The TIFF format preserves the font for all text rendered in the report. This is true even if a font used in the report is not present on the computer being used to view the report. This is the only presentation format that possesses this characteristic. Also, the TIFF format preserves the exact location of each report item relative to other report items. This is true even if report items overlap one another.

Physical pages are supported by the TIFF format. This means when a report is exported to a TIFF file, the renderer pays attention to the physical page size specified for the report and does not let a page grow beyond that size. When a report page is taller or wider than the physical page size, the TIFF renderer splits it into multiple pages. Because physical pages are supported, the TIFF format can be printed with the assurance that the printed report is going to match the report on the screen in both layout and pagination.

Note 

When you’re exporting a report to TIFF or any of the other formats that support physical pages, it is important that your report is not wider than the report page. Be sure to include the page margins when you are calculating how wide the body of your report can be.

Features Not Supported by the TIFF Format

The TIFF format does not support any of the interactive features of a report. You cannot use drill-down functionality to expand rows in a table or rows and columns in a matrix. The rows and columns that were expanded when the report was exported are also expanded in the resulting TIFF file. The rows and columns that were hidden when the report was exported are not included in the resulting TIFF file.

In addition, the TIFF format does not support navigation within a report, between reports, or to a web page. Bookmarks, drill-through functionality, and links to a URL do not work in a TIFF file. The document map does not show up in the TIFF file, even if it is part of the report in the preview format.

Finally, as stated earlier, the TIFF file is simply a series of dots that make up an image. Because of this, it is impossible to copy text and numbers from the TIFF image to paste into another document. Therefore, the TIFF format does not work as a method for passing information to someone who wants to cut-and-paste it into a spreadsheet and do their own ad hoc analysis.

When to Use the TIFF Format

TIFF format files work well for smaller reports that do not utilize interactive functions. The capability of some TIFF viewers to provide annotation features makes this a good choice for sharing analysis among a number of people. The TIFF format also works well for situations where reports are viewed both onscreen and in print. However, users cannot copy numbers from the report to paste into another application to perform their own analysis.

Because the entire content of the report is stored as a bitmap image, TIFF files become very large very fast. A report exported to a TIFF file is as much as ten times as large as other export formats. Use the TIFF export with care so as not to create monstrous export files that are unwieldy to deliver and use.

Adobe PDF Presentation Format

PDF is an acronym for Portable Document Format, which was developed by Adobe Systems, Inc. PDF was designed so a document could be moved from one computer to another—even between computers with different operating systems—and appear exactly the same on both computers.

When a report is rendered to a PDF file, its formatting is stored using a language similar to the PostScript description language. Images that appear in the report are stored right within the PDF file. Text entries in the report remain text; they are not converted to images as they are with the TIFF format.

Viewing PDF Documents

PDF files are viewed using the Adobe Acrobat Reader. The Acrobat Reader is available as a free download from the Adobe website at www.adobe.com. Versions of the Acrobat Reader are available for Windows, Mac, Solaris Sun, Linux, several flavors of UNIX, and even for handheld devices. The Acrobat Reader has features for moving between pages, printing, and zooming in and out.

Features Supported by the PDF Format

The top of the first page of the RenderingTest report exported to a PDF file is shown in Figure 9–6. (Other versions of Adobe Acrobat Reader may appear slightly different.) As with the TIFF format, the PDF format provides a faithful representation of the report as it is seen in the preview layout. It includes colors, images (including background images), and charts. It also preserves strings of text, including embedded new lines and multiple spaces in a row. PDF also enables report items to overlap.

Figure 9–6: The RenderingTest report exported to a PDF file

Just as in the TIFF format, physical pages are supported by the PDF format. When a report page is taller or wider than the physical page size, the PDF renderer splits it into multiple pages. Because physical pages are supported, the PDF format can be printed with the assurance that the printed report will match the report on the screen in both layout and pagination.

The PDF format supports some of the navigation features available in Reporting Services reports. The report’s document map entries become PDF bookmarks. In addition, links to URLs are supported. Also, because the PDF format does retain text and numbers as text and numbers, you can copy these items. Therefore, users can copy-and-paste information from the PDF format into a spreadsheet and do their own ad hoc analysis.

Features Not Supported by the PDF Format

The PDF format preserves the font for almost all text rendered in the report. The exception to this is the situation where a font used in the report is not present on the computer being used to view the report. As you can see in Figure 9–6, the text CENTERED TEXT IN A FANCY FONT did not appear in a fancy font when viewed on a computer that did not have that font loaded.

Although the PDF format supports the document map and a link to a URL, it does not support any of the other interactive features of a report. You cannot use drill-down functionality to expand rows in a table or rows and columns in a matrix. The rows and columns expanded when the report was exported are expanded in the resulting PDF file. The rows and columns hidden when the report was exported are not included in the resulting PDF file. The PDF format does not support Reporting Services bookmarks (not to be confused with the PDF bookmarks that act as a document map) and drill-through functionality.

When to Use the PDF Format

The PDF format works well for reports that need to be distributed across a variety of platforms where maintaining the report layout and pagination are required. If an investment is made in Adobe Standard or Adobe Professional, the PDF format can be used when annotation features are required. The PDF format works well for both large and small reports, and in situations where reports are viewed both on the screen and in print. The PDF format does enable users to copy numbers from a report and paste them into another application to do ad hoc analysis.

The PDF format does not work for reports where drill-down or drill-through functionality is required. It is also not appropriate for situations where one or more fonts that may not be available on the end user’s computer are used in the report and these fonts must be preserved in the report output.

Web Archive Presentation Format

The web archive is a special form of web page. In addition to the HTML formatting code, the web archive file contains all the supporting files required by the page. The supporting files are the images referenced by the HTML. As the name implies, the web archive can be used to gather all the necessary parts of a web page in one place, so it can be easily moved to a different location and archived. This also makes it an excellent candidate for distributing reports in an HTML format.

The extension on web archive files is .mhtml.

Viewing Web Archive Documents

Because web archive documents are self-contained web pages, they are viewed using a web browser. Having a web browser available on a computer is usually not an issue these days, so web archive documents can be distributed across multiple computer platforms. Web archive documents can also be displayed in many e-mail programs that support HTML e-mail messages.

Features Supported by the Web Archive Format

The top of the first page of the RenderingTest report exported to a web archive file is shown in Figure 9–7. The web archive format provides a somewhat faithful representation of the report as it is seen in the preview layout. It includes colors, images (including background images), and charts.

Figure 9–7: The RenderingTest report exported to a web archive file

The web archive format retains only one of the navigation features in Reporting Services reports. It allows for links to URLs to be embedded in the report. Also, because the web archive format retains text and numbers as text and numbers, you can copy these items. Therefore, users can copy-and-paste information from the web format into a spreadsheet and do their own ad hoc analysis.

Features Not Supported by the Web Archive Format

In the web archive format, physical pages are not supported. Instead, the report is presented as one continuous web page. Horizontal lines are added to the report to indicate where the page breaks would occur in other formats. Because of this, the web archive format does not work well when printing a report.

You can see in Figure 9–7, the web archive format does not preserve strings of text, including embedded new lines and multiple spaces in a row. (The text “CENTERED TEXT IN A FANCY FONT” should have a new line after the word “TEXT.” The sentence “There are spaces in this text,” located below the GDS graphic, should have a gap between the word “spaces” and the word “in”.) This is a characteristic of HTML rendering that compresses white space (such as multiple spaces) and ignores new lines. Another HTML limitation is the inability to support overlapping report items as shown by the top line of the report.

Like the PDF format, the web archive format preserves the font for almost all text rendered in the report. The exception, again, is the situation where a font used in the report is not present on the computer being used to view the report. In Figure 9–7, the text “CENTERED TEXT IN A FANCY FONT” is no longer in a fancy font.

Although the web archive format supports a link to a URL, it does not support any of the other interactive features of a report. You cannot use drill-down functionality to expand rows in a table or rows and columns in a matrix. The rows and columns expanded when the report was exported are expanded in the resulting web archive file. The rows and columns hidden when the report was exported are not included in the resulting web archive file. The web archive format does not support document maps, bookmarks, or drill-through functionality.

When to Use the Web Archive Format

The web archive format works well for reports that need to be distributed across a variety of platforms, where pagination and printing are not required. It also works well for situations where the content of the report is to be embedded in an e-mail message. The web archive format works well for both large and small reports. The web archive format does let users copy numbers from a report and paste them into another application for ad hoc analysis.

The web archive format does not work well in situations where the report’s exact formatting must be preserved. Its limitations also make it a bad choice in situations where pagination and printing capabilities are needed. Finally, it does not work when drill-down, drill-through, or other navigation features are required.

Excel Presentation Format

Excel, of course, is Microsoft’s spreadsheet application. The Excel presentation format is simply an Excel workbook file. The workbooks created from Reporting Services reports have multiple tabs or spreadsheets to represent the document map and the logical pages in the report.

Viewing Excel Documents

Excel documents are, of course, viewed using Microsoft Excel. The initial version of SQL Server 2000 Reporting Services required Excel 2002 (version 10) or Excel 2003 (version 11) to display reports exported in the Excel format. SQL Server 2000 Reporting Services SP2 and SQL Server 2005 Reporting Services, however, work with earlier versions of Excel.

Features Supported by the Excel Format

The document map portion of the RenderingTest report as it appears in the Excel file is shown in Figure 9–8. The top of the first page of the RenderingTest report as it appears in the Excel file is shown in Figure 9–9. The Excel format provides as faithful a representation of the report as it can within the confines of spreadsheet rows and columns. It includes colors, foreground images, and charts. Note, if your report contains any charts, they are exported as images by the Excel export. They are not exported as chart objects, so they cannot be modified in Excel.

Figure 9–8: The document map from the RenderingTest report exported to on Excel file

Figure 9–9: The RenderingTest report exported to on Excel file

The Excel format does not create page breaks based on the page size of the report. It does split the report up into separate tabs at locations where your report logic says there should be page breaks. For example, if a grouping on your report has the PageBreakAtStart property set to True, each new instance of this grouping would begin on a new tab in Excel.

The Excel format does include several of the navigation features in Reporting Services reports. It supports the document map as well as bookmarks. It also allows for links to URLs to be embedded in the report. The Excel format does preserve strings of text, including embedded new lines and multiple spaces in a row.

The Excel format is a series of spreadsheets, so naturally it allows for ad hoc analysis to be done on its contents. The contents of most cells are represented as text or numeric constants. However, in some cases, the cell may contain a formula. This results if the value of one report item is a calculation utilizing the value of another report item.

Features Not Supported by the Excel Format

In the Excel format, physical pages are not supported. Only logical page breaks are supported, as mentioned previously. Because of this, the Excel format does not work well when printing a report. As with several of the previous formats, the Excel format preserves the font, except when a font used in the report is not present on the computer being used to view the report. Even though the Excel format supports foreground images, it does not support background images.

Although the Excel format supports several navigation features, it does not support drill-down functionality. The rows and columns in a table or matrix are completely expanded in the Excel format, so all the rows and columns are included. The Excel format does not support drill-through functionality.

When to Use the Excel Format

The Excel format works well for situations when the end user wants to perform some ad hoc analysis after they receive the report. The Excel format should only be used for small and medium-size reports. It should not be used for large reports because the resulting files can become very large. The Excel format does not work well in situations where the report’s exact formatting must be preserved. Also, the Excel format is inappropriate in situations where pagination and printing are required. Finally, it does not work when drill-down or drill-through functionality is needed.

Printed Presentation Format

At first, it may not seem like printing the report on paper belongs in the same category as the other presentation formats. But, if you think about it, rendering the report to hard copy and delivering that printed paper to your users is a valid way to deliver a report. In fact, it was the first way and, for many years, the only way to deliver a report. It seems only fitting, if for no other reason than to give a nod to history, that we include this format along with all the others.

Viewing Printed Documents

Printed documents are viewed on paper. Enough said.

Features Supported by the Printed Format

The printed format faithfully captures all the report formatting, along with both physical and logical page breaks.

Features Not Supported by the Printed Format

The only navigation supported by the printed format requires a thumb and forefinger.

When to Use the Printed Format

The printed format should only be used when your end user requires information to be on paper and is not interested in any of the navigation features or ad hoc analysis made available by the other formats.

HTML Presentation Format

HTML is not listed in the export drop-down list in the Report Designer. It is a choice when you are exporting a report from the Report Manager. It is, in fact, the native mode for report viewing in the Report Manager. (We begin looking at reports in the Report Manager in Chapter 10.)

The HTML format is similar to the web archive format in the way it handles most formatting. This is not too surprising because both use HTML as their document formatting language. Whereas all the other formats are meant to provide a standalone representation of the report, the HTML format uses the report viewer and the Reporting Services web service to present a connected representation of the report. This connection to Reporting Services allows the HTML format to implement all the navigational features.

Viewing HTML Documents

The HTML format is, of course, viewed using a browser. To use features such as document maps, drill-down, and bookmarks, you must have Microsoft Internet Explorer 6.0 with Service Pack 1 or Microsoft Internet Explorer 5.5 with Service Pack 2. In either case, scripting must be enabled in the browser. Drill-through functionality requires Microsoft Internet Explorer 5.01 or above with Service Pack 2 and does not require scripting.

Features Supported by the HTML Format

The HTML format supports almost all the formatting and navigational features of Reporting Services reports. It supports logical page breaks and physical page breaks, after a fashion. The first page of the RenderingTest report in HTML format is shown in Figure 9–10.

Figure 9–10: The RenderingTest report exported to an HTML file

The HTML format does not pay attention to page width. A page can be as wide as it wants. However, the HTML format does create page breaks when a page gets too long. These page breaks do not correspond exactly with the physical size of the page but, rather, are only an approximation. If you print the HTML document, the page breaks created by the HTML format do not correspond to the page breaks required by the printer.

Features Not Supported by the HTML Format

The HTML format does not support overlapping report items. It has the same shortcoming with embedded white space and new lines as described in the web archive section. Given these exceptions and the quirks with pagination described previously, the HTML format supports all other Reporting Services report features.

When to Use the HTML Format

The HTML format works well when your user can view the report while connected to the report server. HTML is the essential format for the occasions when all the navigation features of Reporting Services are required from a single format.

The HTML format does not work well when the report needs to be printed.

Категории