请参考以下代码:
- Dim rpt As New GrapeCity.ActiveReports.SectionReport()
- ' For the code to work, report.rpx must be placed in the bin\debug folder of your project.
- Dim xtr As New System.Xml.XmlTextReader(Application.StartupPath + "\report.rpx")
- rpt.LoadLayout(xtr)
- rpt.Run()
- ' Export the report in HTML format.
- Dim htmlExport1 As New GrapeCity.ActiveReports.Export.Html.Section.HtmlExport()
- htmlExport1.Export(rpt.Document, Application.StartupPath + "\\HTMLExpt.html")
- ' Export the report in PDF format.
- Dim pdfExport1 As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport()
- pdfExport1.Export(rpt.Document, Application.StartupPath + "\\PDFExpt.pdf")
- ' Export the report in RTF format.
- Dim rtfExport1 As New GrapeCity.ActiveReports.Export.Word.Section.RtfExport()
- rtfExport1.Export(rpt.Document, Application.StartupPath + "\\RTFExpt.rtf")
- ' Export the report in text format.
- Dim textExport1 As New GrapeCity.ActiveReports.Export.Xml.Section.TextExport()
- textExport1.Export(rpt.Document, Application.StartupPath + "\\TextExpt.txt")
- ' Export the report in TIFF format.
- Dim tiffExport1 As New GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport()
- tiffExport1.Export(rpt.Document, Application.StartupPath + "\\TIFFExpt.tiff")
- ' Export the report in Excel format.
- Dim xlsExport1 As New GrapeCity.ActiveReports.Export.Excel.Section.XlsExport()
- xlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx
- ' Set the file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions.
- xlsExport1.Export(rpt.Document, Application.StartupPath + "\\XLSExpt.xlsx")
复制代码
同时,在AR7帮助文档的这个章节有更详细的介绍:ActiveReports Developer 7 > ActiveReports Developer Guide > How To > Section Report How To > Export a Section Report |