Change fileName when exporting from HtmlViewer panel

Stimulsoft Reports.NET discussion
Post Reply
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Change fileName when exporting from HtmlViewer panel

Post by IskandarAir »

Dear Stimulsoft team,

is it possible to change name of file that is being exported from "save" button of StiMvcViewerOptions. We want to change .csv file name from Report.csv to more custom value.

regards,
Iskadnar
Attachments
csvSeparator.PNG
csvSeparator.PNG (36.72 KiB) Viewed 4995 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Change fileName when exporting from HtmlViewer panel

Post by Alex K. »

Hello,

You can use the ReportName property of the report.

Thank you.
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Change fileName when exporting from HtmlViewer panel

Post by IskandarAir »

Hi,

Please give more detailed answer. It is not clear where and how

Regards,
Iskanadr
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Change fileName when exporting from HtmlViewer panel

Post by IskandarAir »

in .cshtml we have

Code: Select all

  @Html.Stimulsoft().StiMvcViewer("Report", new StiMvcViewerOptions
{
    Actions =
    {
        ViewerEvent = "ViewerEvent",
        PrintReport = "PrintReport"
    },
....
and in Controller we have

Code: Select all

       public ActionResult ViewerEvent()
        {
            return StiMvcViewer.ViewerEventResult();
        }
through this actionResult .csv file is being generated. So where should we put ReportName Property and How
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Change fileName when exporting from HtmlViewer panel

Post by Alex K. »

Hello,

You can use the following code:
пожалуйста используйте следующий код для этого:

Code: Select all

Actions =
    {
        ViewerEvent = "ViewerEvent",
        PrintReport = "PrintReport",
        ExportReport = "ExportReport"
    },

        public ActionResult ExportReport()
        {
            StiReport report = StiMvcViewer.GetReportObject();
            report.ReportName = "ExportReportFileName";
            report.ReportAlias = report.ReportName;

            return StiMvcViewer.ExportReportResult(report);
        }
Thank you.
Post Reply