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:
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") |
To write the code in C#
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"); |