Exporting Static Reports as XML

Despite it's name, Microsoft's primary objective for ReportML was to generate DAP from Access query and form objects with RPT2DAP.xsl. Data access pages don't support subforms, so RPT2HTML4.xsl doesn't support subreports. In this respect, exporting reports as XML exhibits the same limitation as early Access versions experienced when exporting reports with subreports to Word and Excel.

Note

You can export forms to XML, but doing this isn't very rewarding. Subforms don't export, and the resulting Web page contains an instance of the form for each record of the table or query the form is bound to. Save forms bound to multi-row Recordsets to DAP.


To learn more about exporting forms to DAP, see "Saving Forms as DAP," p. 1082.


The Invoice report is most graphically interesting of the sample reports of Northwind.mdb and NorthwindCS.adp that don't have a subreport. ReportML.xml and RPT2HTML4.xsl create a remarkably accurate representation of the Invoice report. The only problem with exporting the Invoice report as XML is that the resulting Invoice.xml file includes the data for all 2,155 rows of the Invoices query or view and is almost 2MB in size. The code of Invoice.xsl must process 26 elements for each of the 2,155 rows to generate the HTML to display the data. Depending on the speed of your computer, it can take more than a minute to open the resulting Web page on your computer.

Tip

Avoid exporting reports based on large query result sets, especially static reports. XML files are much larger than the resulting HTML files, and the entire XML file must be sent to the client for processing a static report. As mentioned earlier, processing a live Web report on the server and sending HTML to the client is very resource intensive, so keep your live Web reports as short as possible.


To create an Invoice report from single order and export it as XML from Northwind.mdb, do the following:

  1. graphics/data_access_page.gif graphics/properties_window.gif graphics/design_view.gif Open the Invoice report in design view, open the Property window for the report, click the Data tab, and temporarily change the Record Source property value to Invoices Filter.

  2. graphics/preview.gif Change to Print Preview and type a valid OrderID value in the Enter Parameter Value dialog. (11077 is a good choice because it has many line items). Close the report and save your changes.

  3. graphics/data_access_page.gif In the Reports page of the Database window, right-click the Invoice item and choose Export to open the Export Report 'Invoice' To dialog.

  4. Open the Save As Type list, scroll to the bottom, and choose XML Documents (*.xml). Access proposes the name of the report as the file name. Click Export to open the Export XML dialog.

  5. Mark the Data (XML) and Presentation of Your Data (XSL) check boxes to save Invoice.xml, Invoice.xsl, and Invoice.htm in the ...\Office10\Samples folder and the two small bitmaps NameLogo.bmp and PictureLogo.bmp in the Images subfolder. Exporting a schema is optional.

  6. Click OK to close the Export XML dialog. After a second or two, the Enter Parameter Value dialog opens. Type the OrderID value and click OK.

  7. graphics/internet_explorer.gif Open Explorer, navigate to the ...\Office10\Samples folder, and double-click Invoice.htm to display the page in IE 6.0 (see Figure 23.10). It takes a second or two for IE 6.0 to create and modify the two DOMDocument objects.

Figure 23.10. The Invoice page generated by the three files exported from the modified Invoice report is a close replica of the Access original.

graphics/23fig10.jpg

You can't export reports that contain Microsoft Graph objects; use report snapshots to display them. Reports that incorporate PivotChart, or PivotTable views in subreports don't export because of the no-subreport restriction. If you try exporting these types of reports, you receive a "Microsoft Access was unable to export the data" message.

Following are some additional restrictions on exporting reports with RPT2HTML4.xsl:

  • Running Sum, Can Grow, and Can Shrink properties aren't supported.

  • You can't export reports that use snaking (newspaper) columns.

  • SQL aggregates (SUM, AVG, and so on) that return NULL values don't evaluate correctly.

Use DAP to deliver Web pages that include PivotChart or PivotTable controls, or have features that RPT2HTML4.xsl doesn't support. Alternatively, make snapshot files available on your Web site for these reports.

Tip

Type report snapshot in the Ask a Question box, press Enter, and double-click the Publish a Report Snapshot to the Web topic to display the instructions for exporting .snp files to your Web server and authoring Web pages to display them.


graphics/troubleshooting.gif

If you encounter an error when attempting to open the .htm file for an exported report page, see the "Problems Exporting Reports to HTML" topic of the "Troubleshooting" section near the end of the chapter.




Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net