Crystal Reports has ability to export the reports to various formats. You can export report to PDF, Excel, HTML, Text or CSV files very easily. In this tutorial we will discuss the various crystal report export formats.
Crystal Report Export Formats
Crystal Report export formats can be broadly classified into two group
- Page Based Export Type
These format tries to retain the look and feel of the page. They tend to produce the output that closely matches the layout and formatting of the original.
- Record Based Export Type
Record-based formats focus on accurate data representation rather than layout and formatting.
Let us look into some of the very commonly used types of export formats
Character Separated Values
This is a record based export format. Each column is separated by a predefined character called delimiter in the export. If the delimiter used is comma, then it is called comma separated values or CSV. If TAB is used, then it is called TabSeparatedText (TTX). This export file can be opened in Excel or Notepad. This is a very popular way of exporting raw reports to Microsoft Excel users.
Crystal Reports (RPT)
Here report file is saved in .rpt file, which you open in Visual Studio just like any other report. The rpt file is saved with the data. This is the same as using the Save As feature with the Save Data with Report option selected.
This export formats produces RTF files. EditableRTF file that contains only text and no drawing objects while RichText Option produces file that contains text and drawing objects. Both these files can be opened in word processing programs like Microsoft Word.
[Excel, ExcelRecord, ExcelWorkbook]
This produces the report in Excel format. Each column in report corresponds to a column in Excel. Report is exported in page by page basis and added to single worksheet. Worksheet name is the same as the report name. If the worksheet becomes full, then the crystal report creates another worksheet and continues.
If there are more columns in the report than excel can handle, then the additional report columns are omitted from the export. .XLS Format can only support 256 columns while .XLSX formats can handle 16384 columns.
This option also exports report formulas. The formulas that are supported are SUM, AVERAGE, COUNT, MIN and MAX.
There are three export options are available.
Excel Microsoft Excel (97-2003) (*.xls)
This is .XLS format corresponds to Microsoft Excel (97-2003) (*.xls) Version. This is a page based export option and retains the formatting, but lines and boxes are omitted from the report.
ExcelRecord (Microsoft Excel (97-2003) Data-Only)
This is Record based Export Type. Only the report data is exported without the formatting information.
ExcelWorkbook (Microsoft Excel 2007 (XLSX) Data-Only
This is similar to Excel Record format. The difference is that this format supports 16384
Columns while ExcelRecord option can handle only 256 columns.
Creates an HTML format. Useful for mailing nice looking reports to customers. These formats preserve the layout in HTML Format. Crystal report can export to html in HTML 3.2 Version or in HTML 4.0 Version
You can read about difference between HTML32 and HTML40 from here.
Export to PortableDocFormat (PDF) is a page based export type. This export retains both layout and formatting options. Export Report will look the way it displayed in Preview tab. PDF Documents cannot be altered without a specialized software. Hence, choose this format if you want to mail your report or save your report for later viewing.
You can read this how to export crystal report to pdf in c# / VB.NET or the tutorials how to export crystal report to pdf in asp.net c# to learn how to export the report.
This is a special crystal report specific export format. This is a read only version of .rpt file. The data, report definitions and database connection are exported in export. This file can only be opened from Crystal Report Viewer. This protects the report from accidental modification. The Report cannot be modified or the rpt file cannot be created from the file
The one important feature of this export is that it retains connection to the database, so if the report is refreshed it gets the latest data from the report.
This exports the report in plain text. This option does not retain any formatting information.
This option exports the Report in Microsoft Word format. The text and drawing objects of the original report are retained.
This option exports the report in XML format. This uses the SAP Crystal Reports XML schema for the export. This option is usually used for data exchange.
Crystal Report supports three export destinations. Reports can be saved to Disk file or sent over web for end user to download / view. The crystal Report Supports three export destinations
Export To Disk.
The Report Allows you to save the report directly in your hard disk.
Export to HttpResponse
The report is exported to httpresponse object. This is use full in Web applications.
Export to Stream
This option exports report to a stream. Stream is a like a hose where data travels from one end (source) to another end (destination). Recipient at the other end of the stream can read the data.