zoukankan      html  css  js  c++  java
  • crm SSRS 报表 导出格式控制

    如果是使用的网页嵌入ReportView的方式的,可以在aspx上加入js来控制导出格式:

    <script src="js/jquery-1.9.0.js"></script> 
    <script type="text/javascript"> 
    // 使用jquery 1.9 主要是为了兼容ie 6/7/8
    $(document).ready(function(e) {
    
    $("#ReportViewer1_ctl01_ctl05_ctl00 option[value='XML']").remove();
    $("#ReportViewer1_ctl01_ctl05_ctl00 option[value='CSV']").remove();
    $("#ReportViewer1_ctl01_ctl05_ctl00 option[value='MHTML']").remove();
    $("#ReportViewer1_ctl01_ctl05_ctl00 option[value='EXCELOPENXML']").remove();
    $("#ReportViewer1_ctl01_ctl05_ctl00 option[value='IMAGE']").remove();
    $("#ReportViewer1_ctl01_ctl05_ctl00 option[value='WORDOPENXML']").remove();
    
    }); 
    </script>

    如果是asp.net 可以使用,我没有试这个

    public static class ReportViewerExtensions
     {
     public static void SetExportFormatVisibility(this ReportViewer viewer, ReportViewerExportFormat format, bool isVisible)
     {
     
     string formatName = format.ToString();
     
     const System.Reflection.BindingFlags Flags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance;
     System.Reflection.FieldInfo m_previewService = viewer.LocalReport.GetType().GetField("m_previewService", Flags);
     
     System.Reflection.MethodInfo ListRenderingExtensions = m_previewService.FieldType.GetMethod("ListRenderingExtensions", Flags);
     object previewServiceInstance = m_previewService.GetValue(viewer.LocalReport);
     
     IList extensions = (IList)ListRenderingExtensions.Invoke(previewServiceInstance, null);
     System.Reflection.PropertyInfo name = extensions[0].GetType().GetProperty("Name", Flags);
     
     //object extension = null;
     foreach (var ext in extensions)
     {
     
     if ((string.Compare(name.GetValue(ext, null).ToString(), formatName, true) == 0))
     {
     System.Reflection.FieldInfo m_isVisible = ext.GetType().GetField("m_isVisible", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
     
     System.Reflection.FieldInfo m_isExposedExternally = ext.GetType().GetField("m_isExposedExternally", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
     m_isVisible.SetValue(ext, isVisible);
     m_isExposedExternally.SetValue(ext, isVisible);
     
     break;
     }
     
     }
     }
     
     }
     
     public enum ReportViewerExportFormat
     {
     Excel,
     PDF
     }
    Simple to use..
    
    
    ReportViewer1.SetExportFormatVisibility(ReportViewerExportFormat.PDF, false);
  • 相关阅读:
    ugui优化
    jmeter请求时json串的输入格式
    Python文件读写之r+/w+/a+
    python文件操作
    python列表操作
    python嵌套字典的用法
    python字典的基础操作
    python字符串操作
    python基础之字符串为空或空格判断
    【转】Charles手机抓包设置&无法打开火狐网页设置
  • 原文地址:https://www.cnblogs.com/BinBinGo/p/5502035.html
Copyright © 2011-2022 走看看