Control editor button in report viewer

Stimulsoft Reports.WEB discussion
Post Reply
Sreejith
Posts: 6
Joined: Fri Nov 24, 2017 5:58 am

Control editor button in report viewer

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Control editor button in report viewer

Post by Alex K. »

Hello,

You can use the following option:

Code: Select all

@Html.Stimulsoft().StiMvcViewer("MvcViewer1", new StiMvcViewerOptions()
{
    Toolbar =
    {
        ShowEditorButton = false
    },
Thank you.
Sreejith
Posts: 6
Joined: Fri Nov 24, 2017 5:58 am

Re: Control editor button in report viewer

Post 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
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Control editor button in report viewer

Post 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.
Sreejith
Posts: 6
Joined: Fri Nov 24, 2017 5:58 am

Re: Control editor button in report viewer

Post 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
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Control editor button in report viewer

Post 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.
Post Reply