chiname

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

水晶报表导出成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 ();

posted on 2006-03-29 17:17  把我的欢乐带给你  阅读(165)  评论(0)    收藏  举报