的ReportViewer - 隐藏PDF导出 [英] ReportViewer - Hide PDF Export

查看:289
本文介绍了的ReportViewer - 隐藏PDF导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I make use of a ReportView component in a VB.Net 2005 app. How can I disable the PDF export functionality, only keeping the MS Excel format?

推荐答案

我有完全相同的问题,并使用下面的C#方法求解,找到<一href=\"http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/2b849acd-e9cb-4e66-b894-ca9531839db3\">here!:

I had exactly the same problem and solved using the following C# method, found 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中:

and on the page_load:

DisableUnwantedExportFormat(ReportViewer1, "PDF");

这篇关于的ReportViewer - 隐藏PDF导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆