水晶报表导出成EXCEL文件
直接的方式:
crystalReportViewer控件的工具栏里, 有 一个按钮叫做“Export Report”
点击后会出现对话框引导 导出过程。
如果不想用控件的功能。
报表对象 自己也有一个方法叫做 Export(),调用之前先设置报表对象实例的 ExportOptions
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts =
new DiskFileDestinationOptions();
exportOpts = Report.ExportOptions;
// Set the export format.
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.ExportDestinationType =
ExportDestinationType.DiskFile;
// Set the disk file options.
diskOpts.DiskFileName = fileName;
exportOpts.DestinationOptions = diskOpts;
// Export the report.
Report.Export ();

浙公网安备 33010602011771号