To export your reports to the various formats that ActiveReports supports, you must first add the export controls to your Visual Studio toolbox. For more information, see the Adding ActiveReports Controls topic. Here are the export formats that are included with ActiveReports:
- HTML For displaying in Web browsers or e-mail.
- PDF For preserving formatting on different computers.
- RTF For preserving some formatting, but allowing reports to be opened with Word or WordPad.
- Text For transmitting raw data, with little or no formatting.
- TIFF For transmitting faxes.
- XLS For spreadsheets.
To export a report
- From the Visual Studio toolbox, drag the export filter that you want to use onto your Windows form. The control appears in the component tray below the form.
- Double-click in the title bar of the form to create an event-handling method for the form Load event.
- Add code to the event to run the report and export it.
The following examples show what the code for the method looks like for each of the export types.
To write the code in Visual Basic.NET
| Visual Basic.NET code. Paste INSIDE the Form Load event. | Copy Code |
|---|---|
Dim rpt As New NewActiveReport1() rpt.Run() Me.HtmlExport1.Export(rpt.Document, Application.StartupPath + "\\HTMLExpt.html") Me.PdfExport1.Export(rpt.Document, Application.StartupPath + "\\PDFExpt.pdf") Me.RtfExport1.Export(rpt.Document, Application.StartupPath + "\\RTFExpt.rtf") Me.TextExport1.Export(rpt.Document, Application.StartupPath + "\\TextExpt.txt") Me.TiffExport1.Export(rpt.Document, Application.StartupPath + "\\TIFFExpt.tiff") Me.XlsExport1.Export(rpt.Document, Application.StartupPath + "\\XLSExpt.xls") | |
| C# code. Paste INSIDE the Form Load event. | Copy Code |
|---|---|
NewActiveReport1 rpt = new NewActiveReport1(); rpt.Run(); this.htmlExport1.Export(rpt.Document, Application.StartupPath + "\\HTMLExpt.html"); this.pdfExport1.Export(rpt.Document, Application.StartupPath + "\\PDFExpt.pdf"); this.rtfExport1.Export(rpt.Document, Application.StartupPath + "\\RTFExpt.rtf"); this.textExport1.Export(rpt.Document, Application.StartupPath + "\\TextExpt.txt"); this.tiffExport1.Export(rpt.Document, Application.StartupPath + "\\TIFFExpt.tiff"); this.xlsExport1.Export(rpt.Document, Application.StartupPath + "\\XLSExpt.xls"); | |
Getting Started
Adding ActiveReports Controls
Concepts
Export Filters
Walkthroughs
Custom Web Exporting (Std Edition)
Hide All