Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

How to allow Export to Excel only in RDLC ?? (NO Word/PDF)

$
0
0

Hi Friends,

I want my RDLC report report to Allow export  only Excel Reports. I  found this code on internet.    Unfortunately. It hides only  PDF  not the WORD   can anyone help me?

<asp:Panel ID="pnlReport" runat="server" Visible="false" ><rsweb:ReportViewer  Font-Names="DIN Next LT Arabic Light" ID="EventsReportByPeriod" runat="server"  Height="1190px" Width="100%" Visible="true" onload="ReportViewer_OnLoad" ShowPrintButton="False" ShowPromptAreaButton="False" ZoomMode="FullPage" ></rsweb:ReportViewer></asp:Panel>
 protected void ReportViewer_OnLoad(object sender, EventArgs e)
        {


            string[] exportOption = new string[] { "Word", "PDF" };


            foreach (var item in exportOption)
            {
                RenderingExtension extension = EventsReportByPeriod.LocalReport.ListRenderingExtensions().ToList().Find(x => x.Name.Equals(item, StringComparison.CurrentCultureIgnoreCase));
                if (extension != null)
                {
                    System.Reflection.FieldInfo fieldInfo = extension.GetType().GetField("m_isVisible", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
                    fieldInfo.SetValue(extension, false);
                }
            }
        }

  


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>