Online Book Reader

Home Category

Access Cookbook - Ken Getz [336]

By Root 2080 0

Exporting to HTML


Follow these steps to export the report to HTML:

Right-click on the rptCustomer report in the 18-8.MDB database window and choose Export from the menu.

Select XML from the Save as type drop-down at the bottom of the dialog box.

Name the output file CustomerPreferencesHTM and click OK.

Select all three checkboxes on the Export XML dialog box, and click the More Options button.

Specify the output folder where the output files will be located and click the Presentation tab. Make sure that HTML is selected, as shown in Figure 18-21. Click OK.

Figure 18-21. Choosing the presentation format for the report

Using Windows Explorer, browse to the location where you saved the files. You should see four files listed: CustomerPreferencesHTM.htm, CustomerPreferencesHTM.xml, CustomerPreferencesHTM.xsd, and CustomerPreferencesHTM.xsl.

Double-click the CustomerPreferencesHTM.htm file to load it into your browser. It should look like that shown in Figure 18-22.

Figure 18-22. The results of saving a report to HTML

Exporting to ASP


Follow these steps to export the report to ASP:

Right-click on the rptCustomer report in the 18-8.MDB database window and choose Export from the menu.

Select XML from the Save as type drop-down at the bottom of the dialog box.

Name the output file CustomerPreferencesASP and click OK.

Select all three checkboxes on the Export XML dialog box, and click the More Options button.

Specify the output folder where the output files will be located (this can be an IIS application folder) and click the Presentation tab. Select the ASP option and click OK (see Figure 18-23).

Figure 18-23. Specifying ASP output for the report

In order to display the report, you will need to copy the four files created—CustomerPreferencesASP.asp, CustomerPreferencesASP.asp, CustomerPreferencesASP.asp, and CustomerPreferencesASP.asp—to your web server, unless you had the wizard place them there.

Launch CustomerPreferencesASP.asp using the HTTP protocol. The report should look like that shown in Figure 18-24:

http://localhost/TestApps/CustomerPreferencesASP.asp

Figure 18-24. Loading the report as ASP

Discussion


Dissecting the HTML


When you export a report to HTML, Access does a lot of work under the covers to ensure that the output looks almost identical to the output of the report when rendered in Access. Access generates quite a bit of VBScript code to achieve these results.

Open the CustomerPreferencesHTM.htm file in Notepad or another text editor to see how the code applies a transform on the CustomerPreferencesHTM.xml file by invoking the CustomerPreferencesHTM.xsl:

The CustomerPreferencesHTM.xsl file contains all of the formatting for the report, and is quite complex. Figure 18-25 shows just a fragment of the file.

Figure 18-25. The xsl contains the formatting instructions for rendering the XML

After the formatting instructions, the file contains

Return Main Page Previous Page Next Page

®Online Book Reader