Do not need show dialog "Save report as" when load template from byte array or stream

Stimulsoft Reports.NET discussion
Post Reply
Konrad
Posts: 6
Joined: Thu Dec 15, 2022 11:39 am

Do not need show dialog "Save report as" when load template from byte array or stream

Post by Konrad »

Hello, my team and I are currently using "Stimulsoft.Reports.Web.NetCore" Version="2022.1.6". I have encountered a problem where, when I attempt to use SaveReport, the web designer prompts me for a name with a save dialog, even though we are using database-coded Reportfiles with LoadReport from byte array.

I have read a similar problem on viewtopic.php?t=3272; however, I am unsure of how to apply the solution to the current version. I cannot find the StiDesigner class and cannot locate the resource to overwrite the SavingReportInDesigner event.

I want to implement my saving method in the StimulsoftReportcontroller, which is connected to my cshmtl. This is the code I am using:

Code: Select all

public async Task<ActionResult> GetDesignerReport(string id)
{
    var json = RequestStorage.Get(id, false);
    var report = new StiReport();
    return StiNetCoreDesigner.GetReportResult(this, report);
}

public async Task<ActionResult> SaveReport(string id)
{
    var requestParams = StiNetCoreDesigner.GetRequestParams(this);
    requestParams.Action = StiAction.SaveReport;
    var report = StiNetCoreDesigner.GetReportObject(this);
    
}
I have omitted some code that is used to retrieve data from the database, but the Stimulsoft logic remains the same.
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Lech Kulikowski »

Hello,

Please check the following article:
https://www.stimulsoft.com/en/documenta ... report.htm

Thank you.
Konrad
Posts: 6
Joined: Thu Dec 15, 2022 11:39 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Konrad »

I read that, but still don't understand how I can use this for my specific problem. Can you provide some example code or file to show me how I can resolve that issue?
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Lech Kulikowski »

Hello,

Please set the ShowSaveDialog="false" option for the designer.

Thank you.
Konrad
Posts: 6
Joined: Thu Dec 15, 2022 11:39 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Konrad »

Hello,

It's possible that I haven't specified my problem clearly. I have some logic in my database and "save" and "save as" controller methods. I don't want a save dialog window to be displayed when "save" is selected. However, it should still be displayed when "save as" is clicked.
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Lech Kulikowski »

Hello,

Ok. In that case, please remove option and add the following code:

Code: Select all

<script>
        //where jsStiNetCoreDesigner -> js + Designer ID
        jsStiNetCoreDesigner.onready = function () {
            jsStiNetCoreDesigner.ActionSaveReport = function (nextFunc, autoSave) {
                jsStiNetCoreDesigner.SendCommandSaveReport(false, autoSave);
                if (nextFunc) nextFunc();
            }          
        }
    </script>
Thank you.
Konrad
Posts: 6
Joined: Thu Dec 15, 2022 11:39 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Konrad »

I'm a bit confused about how to use the script you gave me in my cshtml file because I'm using the ASP.NET Core MVC Stimulsoft version. Can you explain it in simpler terms or maybe show me an example file? Thanks a lot!
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Do not need show dialog "Save report as" when load template from byte array or stream

Post by Lech Kulikowski »

Hello,

We apologize for the delay, but we need some extra time to prepare a sample for you.

Thank you for your patience.
Post Reply