Glossary Item Box
Included with ActiveReports are several specialized export filters (HTML, PDF, RTF, Excel, TIFF and Text). With these export filters, reports easily can be made available to others in various file formats.
This walkthrough illustrates how to export a report to PDF, HTML, RTF, Text, TIFF and Excel files.
This walkthrough is split up into the following activities:
To complete the walkthrough, you must have access to the NorthWind database (NWind.mdb).
When you have completed this walkthrough, you will have created PDF, HTML, RTF, Text, TIFF and Excel files which can be found in the Bin/Debug (C#) or Bin (VB.NET) subfolder of your project's folder.
To add an ActiveReport to your project
To add the export filters to your project
To connect the report to a data source
To add controls to the report
Control | DataField | Name | Text | Location |
---|---|---|---|---|
TextBox | LastName | txtLastName | Last Name | 0.0625, 0.0625 |
TextBox | FirstName | txtFirstName | First Name | 1.1875, 0.0625 |
To write the code in Visual Basic
To write the code in C#
The following example shows what the code for the method looks like.
' Visual Basic Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load Dim rpt As New rptExports() 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") End Sub
//C# private void Form1_Load(object sender, System.EventArgs e) { rptExports rpt = new rptExports(); 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"); }
See Also |
Samples | Walkthroughs | Custom Web Exporting Walkthroughs
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.