In a page layout, ActiveReports provides various export filters that you can use to export reports to supported file formats. Here are the export formats that are included with ActiveReports:
- HTML For displaying on Web browsers or e-mail. You can access the HTML Export filter by adding the reference to GrapeCity.ActiveReports.Export.Html.v7.dll in your project.
- PDF For preserving formatting on different computers. You can access the PDF Export filter by adding the reference to GrapeCity.ActiveReports.Export.Pdf.v7.dll in your project.
- RTF For preserving some formatting, but allowing reports to be opened with Word or WordPad. You can access the RTF Export filter by adding the reference to GrapeCity.ActiveReports.Export.Word.v7.dll in your project.
- Text For transmitting raw data, with little or no formatting. You can access the Text Export filter by adding the reference to GrapeCity.ActiveReports.Export.Xml.v7.dll in your project.
- TIFF For transmitting faxes. You can access the Image Export filter by adding the reference to GrapeCity.ActiveReports.Export.Image.v7.dll in your project.
- Excel For displaying as spreadsheets. You can access the Excel Export filter by adding the reference to GrapeCity.ActiveReports.Export.Excel.v7.dll in your project.
Note: HTML Export requires the .NET Framework full profile version. To ensure you are using the full profile version, go to the Visual Studio Project menu > Properties > Compile tab > Advanced Compile Options (for Visual Basic projects) or to the Project menu > Properties > Application tab (for C# projects) and under Target framework select a full profile version. |
Use the following steps to export reports through export filters. These steps assume that you have already created a Windows Application and added the export controls to your Visual Studio toolbox. See Adding ActiveReports Controls for further information.
To export a report
- Place the Invoice.rdlx report inside your project's Bin>Debug folder.
- In the Solution Explorer, right-click the References node and select Add Reference.
- In the Add Reference dialog that appears, select the following references and click OK to add them to your project.
GrapeCity.ActiveReports.Export.Excel.v7
GrapeCity.ActiveReports.Export.Html.v7
GrapeCity.ActiveReports.Export.Image.v7
GrapeCity.ActiveReports.Export.Pdf.v7
GrapeCity.ActiveReports.Export.Word.v7
GrapeCity.ActiveReports.Export.Xml.v7 - Double-click the Windows Form to create a Form_Load event.
- Add the following code to add Invoice.rdlx to your project.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form_Load event. Copy Code ' Create a page report rpt. Dim rpt As New GrapeCity.ActiveReports.PageReport() ' Load the report you want to export. ' For the code to work, this report must be stored in the bin\debug folder of your project. rpt.Load(New System.IO.FileInfo ("invoice.rdlx")) Dim MyDocument As New GrapeCity.ActiveReports.Document.PageDocument (rpt)
C# code. Paste INSIDE the Form_Load event. Copy Code // Create a page report rpt. GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport(); // Load the report you want to export. // For the code to work, this report must be stored in the bin\debug folder of your project. rpt.Load(new System.IO.FileInfo ("invoice.rdlx")); GrapeCity.ActiveReports.Document.PageDocument MyDocument = new GrapeCity.ActiveReports.Document.PageDocument (rpt);
- Add the following code to export Invoice.rdlx to all the formats.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form_Load event. Copy Code ' Export the report in HTML format. Dim HtmlExport1 As New GrapeCity.ActiveReports.Export.Html.Section.HtmlExport() HtmlExport1.Export(MyDocument, Application.StartupPath + "\HTMLExpt.html") ' Export the report in PDF format. Dim PdfExport1 As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport() PdfExport1.Export(MyDocument, Application.StartupPath + "\PDFExpt.pdf") ' Export the report in RTF format. Dim RtfExport1 As New GrapeCity.ActiveReports.Export.Word.Section.RtfExport() RtfExport1.Export(MyDocument, Application.StartupPath + "\RTFExpt.rtf") ' Export the report in text format. Dim TextExport1 As New GrapeCity.ActiveReports.Export.Xml.Section.TextExport() TextExport1.Export(MyDocument, Application.StartupPath + "\TextExpt.txt") ' Export the report in TIFF format. Dim TiffExport1 As New GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport() TiffExport1.Export(MyDocument, Application.StartupPath + "\TIFFExpt.tiff") ' Export the report in Excel format. Dim XlsExport1 As New GrapeCity.ActiveReports.Export.Excel.Section.XlsExport() ' Set a file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions. XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx XlsExport1.Export(MyDocument, Application.StartupPath + "\XLSExpt.xlsx")
C# code. Paste INSIDE the Form_Load event. Copy Code // Export the report in HTML format. GrapeCity.ActiveReports.Export.Html.Section.HtmlExport HtmlExport1 = new GrapeCity.ActiveReports.Export.Html.Section.HtmlExport(); HtmlExport1.Export(MyDocument, Application.StartupPath + "\\HTMLExpt.html"); // Export the report in PDF format. GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport(); PdfExport1.Export(MyDocument, Application.StartupPath + "\\PDFExpt.pdf"); // Export the report in RTF format. GrapeCity.ActiveReports.Export.Word.Section.RtfExport RtfExport1 = new GrapeCity.ActiveReports.Export.Word.Section.RtfExport(); RtfExport1.Export(MyDocument, Application.StartupPath + "\\RTFExpt.rtf"); // Export the report in text format. GrapeCity.ActiveReports.Export.Xml.Section.TextExport TextExport1 = new GrapeCity.ActiveReports.Export.Xml.Section.TextExport(); TextExport1.Export(MyDocument, Application.StartupPath + "\\TextExpt.txt"); // Export the report in TIFF format. GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport TiffExport1 = new GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport(); TiffExport1.Export(MyDocument, Application.StartupPath + "\\TIFFExpt.tiff"); // Export the report in XLSX format. GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport(); // Set a file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions. XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx; XlsExport1.Export(MyDocument, Application.StartupPath + "\\XLSExpt.xlsx");
- Press F5 to run the application. The exported files are saved in the bin\debug folder.
Export Filters
Concepts
Exporting