如何从rdlc隐藏rdlc word和excel选项

时间:2018-11-16 21:33:44

标签: c# asp.net rdlc

如何在RDLC报告中隐藏Word和excel选项,请任何人..帮助我,我正在搜索3个小时,但未成功 请帮我这个我只想要PDF而不是word并擅长这样做

protected void ReportViewer1_PreRender(object sender, EventArgs e)
        {
            DisableUnwantedExportFormat(ReportViewer1, "Excel");
            DisableUnwantedExportFormat(ReportViewer1, "Word");
        }
        public void DisableUnwantedExportFormat(ReportViewer ReportViewerID, string strFormatName)
        {
            FieldInfo info;
            foreach (RenderingExtension extension in ReportViewerID.LocalReport.ListRenderingExtensions())
            {
                if (extension.Name.Trim().ToUpper() == strFormatName.Trim().ToUpper())
                {
                    info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
                    info.SetValue(extension, false);
                }
            }
        }

0 个答案:

没有答案