public ActionResult ExportStiReport(Stream stream, IStumulsoftReportInfo ri, String targetFormat, Boolean saveFile = true)
        {
            var r = StiReportExtensions.CreateReport(stream, ri.Name);

            r.AddDataModel(ri.DataModel);
            if (ri.Variables != null)
            {
                r.AddVariables(ri.Variables);
            }
            if (targetFormat == "pdf")
            {
                return(StiMvcReportResponse.ResponseAsPdf(r, StiReportExtensions.GetPdfExportSettings(), saveFileDialog: saveFile));
            }
            else if (targetFormat == "excel")
            {
                return(StiMvcReportResponse.ResponseAsExcel2007(r, StiReportExtensions.GetDefaultXlSettings(), saveFileDialog: saveFile));
            }
            else if (targetFormat == "word")
            {
                return(StiMvcReportResponse.ResponseAsWord2007(r, StiReportExtensions.GetDefaultWordSettings(), saveFileDialog: saveFile));
            }
            else if (targetFormat == "opentext")
            {
                return(StiMvcReportResponse.ResponseAsOdt(r, StiReportExtensions.GetDefaultOdtSettings(), saveFileDialog: saveFile));
            }
            else if (targetFormat == "opensheet")
            {
                return(StiMvcReportResponse.ResponseAsOds(r, StiReportExtensions.GetDefaultOdsSettings(), saveFileDialog: saveFile));
            }
            else
            {
                throw new NotImplementedException($"Format '{targetFormat}' is not supported in this version");
            }
        }
Example #2
0
        public ActionResult Export()
        {
            var appPath   = Server.MapPath("~/");
            var dashboard = Helpers.Dashboard.CreateTemplate(appPath);

            return(StiMvcReportResponse.ResponseAsExcel2007(dashboard));
        }
Example #3
0
        // saveFileDialog: true -> download
        // saveFileDialog: false -> show
        public StiMvcActionResult ExportStiReport(ReportInfo ri, String format, bool saveFile = true)
        {
            var targetFormat = (format ?? "pdf").ToLowerInvariant();

            using (var stream = _host.ApplicationReader.FileStreamFullPath(ri.ReportPath))
            {
                var r = StiReportExtensions.CreateReport(stream, ri.Name);
                r.AddDataModel(ri.DataModel);
                if (ri.Variables != null)
                {
                    r.AddVariables(ri.Variables);
                }
                if (targetFormat == "pdf")
                {
                    return(StiMvcReportResponse.ResponseAsPdf(r, StiReportExtensions.GetPdfExportSettings(), saveFileDialog: saveFile));
                }
                else if (format == "excel")
                {
                    return(StiMvcReportResponse.ResponseAsExcel2007(r, StiReportExtensions.GetDefaultXlSettings(), saveFileDialog: saveFile));
                }
                else if (format == "word")
                {
                    return(StiMvcReportResponse.ResponseAsWord2007(r, StiReportExtensions.GetDefaultWordSettings(), saveFileDialog: saveFile));
                }
                else if (format == "opentext")
                {
                    return(StiMvcReportResponse.ResponseAsOdt(r, StiReportExtensions.GetDefaultOdtSettings(), saveFileDialog: saveFile));
                }
                else if (format == "opensheet")
                {
                    return(StiMvcReportResponse.ResponseAsOds(r, StiReportExtensions.GetDefaultOdsSettings(), saveFileDialog: saveFile));
                }
                else
                {
                    throw new NotImplementedException($"Format '{targetFormat}' is not supported in this version");
                }
            }
        }
        public ActionResult ExportExcel()
        {
            var report = this.GetDashboard();

            return(StiMvcReportResponse.ResponseAsExcel2007(report));
        }