Hiding Export to items from local report
I am using rdlc that is local report and showing the report thru reportviewer in aspx page. Reports are showing fine but I have one requirement. By default, Export to options are limited to Word, PDF and Excel. Now I want to remove Word and Excel from the list. How could I achieve this? Any helpful pointers???Please mark the post answered if it serves your query. Subhendu De
December 8th, 2010 8:24am

Hi Subhendu De, I’m afraid currently we are not allowed to customize the export option directly. However, as a workaround, we can first disable the export option by setting the ShowExportControls property of the ReportViewer to False. Then, in order to export report to PDF, we need add a button and invoke the method ReportViewer.LocalReport.Render() in the button click event handler to generate PDF. For more information about using this method, please refer to the link below: http://msdn.microsoft.com/en-us/library/ms251839(v=VS.90).aspx Additionally, since the requirement to disable export options is reasonable, please submit your suggestion at https://connect.microsoft.com/VisualStudio/. Your feedback is valuable for us to improve our products and increase the level of service provided. We appreciate your understanding. If you have any question, please feel free to ask. Regards, Tony ChainTony Chain [MSFT] MSDN Community Support | Feedback to us Get or Request Code Sample from Microsoft Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2010 6:22am

Hi, Based on my testing, we can also use JavaScript to remove the Word and Excel export options. Please refer to the steps blew: 1. Preview the web page which contains the ReportViewer control. 2. Check the source code of page. Find the id of the div which contains the export options. It is "ReportViewer1_ctl06_ctl04_ctl00_Menu" in my page. <script type="text/javascript"> window.onload = function () { var formatDropDown = document.getElementById('ReportViewer1_ctl06_ctl04_ctl00_Menu'); var formats = formatDropDown.childNodes; if (formatDropDown != null) { formatDropDown.removeChild(formats[0]); formatDropDown.removeChild(formats[1]); } } </script> 3. In the aspx file, add the JavaScript below: Please correct the id based on your report. After that, only the PDF option still exists. Thanks, Tony Chain Tony Chain [MSFT] MSDN Community Support | Feedback to us Get or Request Code Sample from Microsoft Please remember to mark the replies as answers if they help and unmark them if they provide no help.
December 21st, 2010 8:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics