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");
            }
        }
示例#2
0
        ActionResult ExportStiReport(ReportInfo ri)
        {
            var r = StiReportExtensions.CreateReport(ri.ReportPath, ri.Name);

            if (ri.DataModel != null)
            {
                var dynModel = ri.DataModel.GetDynamic();
                foreach (var x in dynModel)
                {
                    r.RegBusinessObject(x.Key, x.Value);
                }
            }
            if (ri.Variables != null)
            {
                r.AddVariables(ri.Variables);
            }
            var ms = new MemoryStream();

            // saveFileDialog: true -> download
            // saveFileDialog: false -> show
            return(StiMvcReportResponse.ResponseAsPdf(r, StiReportExtensions.GetPdfExportSettings(), saveFileDialog: true));
        }
示例#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 ExportPdf()
        {
            var report = this.GetDashboard();

            return(StiMvcReportResponse.ResponseAsPdf(report));
        }
        public ActionResult ExportPdf()
        {
            StiReport report = this.GetReport();

            return(StiMvcReportResponse.ResponseAsPdf(report));
        }