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

查看:25
本文介绍了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# 方法解决,发现 这里!:

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天全站免登陆