Page 1 of 1
Control editor button in report viewer
Posted: Fri Jan 19, 2018 4:12 am
by Sreejith
Hi there,
We have a scenario where even if the report has got editable components, we don't want user to edit the report. But currently report viewer will display editor button when the report user is opening has got editable components. I'm using Reports.Web v2018.1.5.
Is there any way I can control displaying editable button? I noticed that report parameters has got isEditableReport variable which decide whether to show the button or not. Can I able to set this variable from my controller action?
Appreciate your help.
Thanks,
Sree
Re: Control editor button in report viewer
Posted: Fri Jan 19, 2018 9:25 am
by Alex K.
Hello,
You can use the following option:
Code: Select all
@Html.Stimulsoft().StiMvcViewer("MvcViewer1", new StiMvcViewerOptions()
{
Toolbar =
{
ShowEditorButton = false
},
Thank you.
Re: Control editor button in report viewer
Posted: Sun Jan 21, 2018 10:47 pm
by Sreejith
Hi Alex,
Thanks for your reply. In my case, I want editor button to be displayed for certain reports and not for others. So I can't use the above option as it will disable the editor button on all reports.
Is there any way I can do it using code. Something inside "GetReport" action method? I noticed an override option for StiMvcViewer.GetReportResult function to accept StiRequestParams as argument. I was looking for some way to switch on and off editor button as a parameter under StiViewerParams.
Looking forward for your response to get a way to get this working.
Thanks,
Sree
Re: Control editor button in report viewer
Posted: Mon Jan 22, 2018 3:48 pm
by HighAley
Hello, Sree.
There is a
PreviewSettings property of the report.
You could change it and the Editor button could be disabled this way.
This property will work in StiMvcViewer from our next build.
You could change the property in the GetReport action using next code:
Code: Select all
report.PreviewSettings = report.PreviewSettings ^ (int)Stimulsoft.Report.Viewer.StiPreviewSettings.Editor;
Thank you.
Re: Control editor button in report viewer
Posted: Tue Jan 23, 2018 4:19 am
by Sreejith
Hi HighAley,
Glad to know that there is an option to do this. We are using Reports.Web v2018.1.5. Is this option not available yet?
Just to confirm the usage, can I use the below code to remove the editor option from the viewer? Could you please explain the usage a bit more
Code: Select all
report.PreviewSettings = report.PreviewSettings & ~(int)Stimulsoft.Report.Viewer.StiPreviewSettings.Editor;
Thanks,
Sree
Re: Control editor button in report viewer
Posted: Tue Jan 23, 2018 12:47 pm
by HighAley
Hello, Sree.
This feature will be available in our next build (2018.1.7).
Yes, your expression should work the same way.
Thank you.