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);
  • 相关阅读:
    ZeptoLab Code Rush 2015
    UVa 10048 Audiophobia【Floyd】
    POJ 1847 Tram【Floyd】
    UVa 247 Calling Circles【传递闭包】
    UVa 1395 Slim Span【最小生成树】
    HDU 4006 The kth great number【优先队列】
    UVa 674 Coin Change【记忆化搜索】
    UVa 10285 Longest Run on a Snowboard【记忆化搜索】
    【NOIP2016提高A组模拟9.28】求导
    【NOIP2012模拟10.9】电费结算
  • 原文地址:https://www.cnblogs.com/BinBinGo/p/5502035.html
Copyright © 2011-2022 走看看