您当前的位置: 首页 > 

[水晶报表]导出文件格式的设置.

发布时间:2012-07-13 11:25:51 ,浏览量:0

最近去折腾 水晶报表.

用水晶报表导出文件的时候,  有这样一个 文件类型选择:

对于终端用户来说,  导出这个  RPT  格式的文件 , 并没有多大的意义。

希望 格式的下拉列表里面,  不要出现 这个 类型的选择。

查看了一下 CrystalReportViewer   的属性, 里面有一个   int  类型 的 AllowedExportFormats 属性。

折腾了一下代码, 效果还行。

定义一个枚举.

/// /// 可导出的文件格式. /// public enum AllowedExportFormat {  ///  /// PDF.  ///  PDF = 1,

 ///  /// Excel(97-2003)  ///  Excel2003 = 2,

 ///  /// Word (97-2003)  ///  Word2003 = 4,

 ///  /// RTF  ///  RTF = 8,

 ///  /// Crystal Report  ///  CrystalReport = 16,

 ///  /// Excel(97-2003) (仅限数据)  ///  Excel2003DataOnly = 32,

 ///  /// Word (97-2003) - 可编辑  ///  Word2003EditAble = 64,

 ///  /// XML  ///  XML = 128,

 ///  /// Excel (仅限数据)  ///  ExcelDataOnly = 512,

 ///  /// CSV  ///  CSV = 1024 }

设置控件的属性

CrystalReportViewer1.AllowedExportFormats =  (int)(AllowedExportFormat.CSV   | AllowedExportFormat.Excel2003   | AllowedExportFormat.Excel2003DataOnly   | AllowedExportFormat.ExcelDataOnly   | AllowedExportFormat.PDF   | AllowedExportFormat.RTF   | AllowedExportFormat.Word2003   | AllowedExportFormat.Word2003EditAble   | AllowedExportFormat.XML);

最后运行的结果:

转自:http://hi.baidu.com/wangzhiqing999/blog/item/71eaf53cd3a5d80296ddd867.html

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    109276博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0802s