asp.net - ReportViewer - 隐藏 PDF 导出

标签 asp.net reporting-services reportviewer

我在 VB.Net 2005 应用程序中使用 ReportView 组件。如何禁用 PDF 导出功能,仅保留 MS Excel 格式?

最佳答案

我遇到了完全相同的问题,并使用以下 C# 方法解决了,发现 here !:

public void DisableUnwantedExportFormat(ReportViewer ReportViewerID, string strFormatName)
{
    FieldInfo info;

    foreach (RenderingExtension extension in ReportViewerID.LocalReport.ListRenderingExtensions())
     {
        if (extension.Name == strFormatName)
        {
             info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
            info.SetValue(extension, false);
        }
    }
}

在 page_load 上:

DisableUnwantedExportFormat(ReportViewer1, "PDF");

关于asp.net - ReportViewer - 隐藏 PDF 导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1499885/

相关文章:

sql-server - 从字段设置 SSRS BackgroundImage Source

c# - 在 ReportViewer 中刷新数据集中的字段

visual-studio-2013 - Visual Studio 2013 RDLC 页面大小错误

c# - UrlEncoding - 我应该使用哪种编码?

c# - 在数据表中追加记录

c# - 回发后 Listview 未在 databind() 上完全更新

c# - IL Rewrite 无法加载 .Net DLL

reporting-services - 基于多个多值参数SSRS的列可见性

sql - 需要查询 SSRS 数据库以获取报告访问权限

reporting-services - SSRS 2008 R2 - SSRS 2012 - 报告查看器 : Reports are blank in Safari and Chrome