Exporting the Report
Exporting the report to common file formats
C1Report has a RenderToFile method that allows you to export your report to several file formats, including HTML, RTF, PDF, TIFF, Text, and XLS. For example, the following code creates PDF and XLS versions of a report:
' Load report definition
c1r.Load(reportFile, reportName)
' Export to PDF
c1r.RenderToFile(outFile + ".pdf", FileFormatEnum.PDF)
c1r.RenderToFile(outFile + ".xls", FileFormatEnum.Excel)
• C#
// Load report definition
c1r.Load(reportFile, reportName);
// Export to PDF
c1r.RenderToFile(outFile + ".pdf", FileFormatEnum.PDF);
c1r.RenderToFile(outFile + ".xls", FileFormatEnum.Excel);
Note: When a document is exported to the RTF or the DOCX formats with the "preserve pagination" option selected, text is placed in text boxes and the ability to reflow text in the resulting document may be limited.
Exporting the report to custom formats
If you want to export the report to a format that is not supported by C1Report, you can write your own export filter class and use the C1Report.RenderToFilter method to render the report into your custom filter.
Custom filters are classes that derive from the C1.Win.C1Report.ExportFilter class and override a few simple methods like StartReport, StartSection, RenderField, EndSection, and EndReport.
Writing a custom export filter is not difficult. It can be used, for example, to create custom XML representations of your reports for later processing by other applications.
|