绑定datateble都是一样的VB和C#都是一样的,你是想要VB的下载Excel的代码吗?
VB导出Excel的代码:
- ' Provide the page report you want to render.
- Dim report As New GrapeCity.ActiveReports.PageReport()Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(report)
- ' Create an output directory.
- Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyExcel")
- outputDirectory.Create()
- ' Provide settings for your rendering output.
- Dim excelSetting As New GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings()
- excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls
- Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = excelSetting
- ' Set the rendering extension and render the report.
- Dim excelRenderingExtension As New GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension()
- Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
- ' Overwrite output file if it already exists.
- outputProvider.OverwriteOutputFile = True
- reportDocument.Render(excelRenderingExtension, outputProvider, excelSetting.GetSettings())
复制代码
|