Hi,
I am using ReportViewer 2010 and using code (posted below) to hide certain options from export, its working fine for parent report, but when i am clicking on parent report to view child report, then export option in child report is showing all the
items in export option which all are hided in parent report. So please help me out.
private void DisableUnwantedExportFormats()
{
FieldInfo info;
foreach (RenderingExtension extension in rptviewerByBrandBySentimentAttribute.ServerReport.ListRenderingExtensions())
{
if (extension.Name != "PDF" && extension.Name != "ASPPT" && extension.Name != "ASPPTX" && extension.Name != "EXCEL" && extension.Name != "MHTML") // only PDF and Excel
- remove the other options
{
info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
info.SetValue(extension, false);
}
if (extension.Name == "ASPPT") // change "Excel" name on the list to "Excel 97-2003 Workbook"
{
info = extension.GetType().GetField("m_localizedName", BindingFlags.Instance | BindingFlags.NonPublic);
if (info != null) info.SetValue(extension, "PowerPoint 2003");
}
if (extension.Name == "ASPPTX") // change "Excel" name on the list to "Excel 97-2003 Workbook"
{
info = extension.GetType().GetField("m_localizedName", BindingFlags.Instance | BindingFlags.NonPublic);
if (info != null) info.SetValue(extension, "PowerPoint 2007");
}
}
}
neha