如何在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);
}
}
}