Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step tutorials and online videos.

Click Here To Learn More »

19.04 Quick Exporting to Disk

Easy Exporting To Disk

There is one method that makes exporting easy: ExportToDisk(). Without a doubt, the ExportToDisk() method is the most popular way of exporting a report because you are only required to specify the format type and the filename. The following code shows an example or saving a report as a PDF file. You can see that only one line of code is required to export the report to a PDF formatted file.

myReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "C:\Report.PDF")

The first parameter uses the ExportFormatType enumeration to specify the format the file should be saved in and the second parameter is the file name. The ExportToDisk() method supports the most common formats used for viewing files. Table 19-2 lists the format and enumeration constants associated with each. They are within the namespace CrystalDecisions.Shared.ExportFormatType.

Table 19-2. Enumeration constants for the export format.

Format File Extension Enumeration Constant
Adobe Acrobat .PDF PortableDocFormat
Rich Text Format .RTF RichText
HTML 3.2 .HTM / .HTML HTML32
HTML 4.0 .HTM / .HTML HTML40
MS Word .DOC WordForWindows
MS Excel .XLS Excel
MS Excel .XLS ExcelRecord (data only)
Crystal Reports .RPT CrystalReport

The drawback to using the ExportToDisk() method is that it doesn’t have any parameters for customizing the export format. For example, there is no way to specify the page...

Get UNLIMITED Crystal Reports Online Training!

Click Here To Start Your Training!

1500+ Tutorial Pages

Complete Crystal Reports Online Training with over 1,500 pages of better than book quality Crystal Reports tutorials.

Step-by-step Online Videos

Learn at your own pace from the comfort of your home! Pause, rewind and watch online training videos anytime!

Online Community

Members-only community where you can post and answer questions. The community is checked on a regular basis by best selling Crystal Reports book author Brian Bischof to help answer your questions.

Cut & Paste Source Code

Save time with simple cut and paste source code you can use right now in your next report!

Click Here To Start Your Training!