0

I have googled too many links but all I get is to handle above requirement using report viewer at server side only.

I want some solution at my end only.

For ex: While creating\modifying rdlc file, would it be possible to restrict the export options ? Either using the report properties or writing custom code in report code section.

I have worked on rdl files & not rdlc's so don't have much idea about it.

I hope this question stands correctly under stack standards !

Thanks,

EDIT: This is not a possible duplicate questions because this question focusing on how to achieve the requirement in the report itself without making any changes in the configuration files at server. Other questions\answers focused on changes in the configuration files at server.

Aditya
  • 2,299
  • 5
  • 32
  • 54
  • 1
    Possible duplicate of [ReportViewer - Hide PDF Export](http://stackoverflow.com/questions/1499885/reportviewer-hide-pdf-export) – bitnine Sep 07 '16 at 13:22

2 Answers2

2

Thank you @alejandro zuleta.

We can write a visibility expression for the specific tables\object which is showing the data in the report. The data will be visible only when the report is viewed in application OR exported to PDF.

=IIF(Globals!RenderFormat.IsInteractive = "True", False, IIF(Globals!RenderFormat.Name = "PDF", False, True))

OR

We can suppress the export options other than PDF for all the SSRS reports (rdlc) available. For this, we need to add below jQuery code in the end of the </body> of SSRSReportViewer.aspx report viewer control.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function () {
          $("a[title='Word']").parent().hide();
          $("a[title='Excel']").parent().hide();  });
</script>
Aditya
  • 2,299
  • 5
  • 32
  • 54
1

It is not possible to restrict export options using report custom code or any report property. The closest thing you can do using report properties is hide report components based on the Globals!RenderFormat.IsInteractive built-in field.

However, you can customize Report Viewer web app to change the exporting options matching your needs. Report Viewer has several properties that let you modify things like Show export menu item.

REFERENCE

Also read this article where there is an example of PDF export customization.

Let me know if this helps.

alejandro zuleta
  • 13,962
  • 3
  • 28
  • 48
  • Hi alejandro zuleta , as you mentioned is perfect & correct. One more question, would it be possible to enable\show print button in the toolbar of the SSRS report ? Or code it in SSRS using any expressions ? I am able to code window.open() but it is printing scrollbar & all ... – Aditya Sep 09 '16 at 05:23
  • 1
    @Aditya, Using expressions it is not possible, the Report Viewer toolbar shows the print button by default, you can disable/enable it programmatically (SSRS 2008) though. [Check this](https://msdn.microsoft.com/en-us/library/ms155874(v=sql.105).aspx). Note if you are generating your reports from a browser, some browsers are not compatible with print SSRS control. In a SSRS 2012 environment print control is not visible in Chrome but visisble in IE and Microsoft Edge. – alejandro zuleta Sep 09 '16 at 13:00