Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

15.13 XML

XML

XML (eXtensible Markup Language) is quickly becoming the standard for data exchange between applications as well as sharing data among corporations. XML is popular because it is a self-defining file. It uses a hierarchy of elements and each element has tags and values to define them. You can export a report to XML and it builds a hierarchy of tags which match your report structure. For example, the following code is an excerpt from an XML export for the Details section.



Figure 15-9. XML excerpt defining the Details section.

Notice how each line is indented as the levels get deeper. This shows the hierarchy of the elements. The first line defines a row in the Details section. Below that, it maps out the field names, their data type, and the value for that field. It does this for each field in that row of the detail section. This is repeated for every row on the report.

The biggest drawback to XML files is their size. As you might imagine, when even the smallest detail has to be written out within a complex hierarchy, the amount of information necessary to convey a report’s information can grow dramatically. Don’t be surprised if the XML file for a simple report is more than a megabyte in size.

Even though the file sizes can be huge, the benefit is that XML files are compatible with many programs. You can also use a CSS (Cascading Style Sheet) to define how each element is formatted. This lets you customize how the XML file is printed.

Question: I want my users to be able to export to PDF format, but not the MS Office formats. Since Word and Excel files can be modified, this lets them invalidate the data and it presents a security risk. Is it possible to keep the user from exporting to certain formats?

Answer: Yes, you can disable certain export features. When running the Crystal Reports installation on a computer, you can specify which export options are installed and which ones are not available.