• 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);
  • 相关阅读:
    图片上传
    解决Vuex持久化插件-在F5刷新页面后数据不见的问题
    vue登录
    拖动排序的vue组件
    vue图片懒加载
    vue中使用图片预加载
    前端架构知识体系
    html判断IE版本
    HighCharts 在IE8下饼图不显示的问题
    新一代调试王者Console
  • 原文地址:https://www.cnblogs.com/BinBinGo/p/5502035.html
Copyright © 2020-2023  润新知