Beispiel #1
0
 public ActionResult RDLCReport()
 {
     /*
      * List<Syncfusion.JavaScript.Models.ReportViewer.ReportDataSource> datasources = new List<Syncfusion.JavaScript.Models.ReportViewer.ReportDataSource>();
      *
      * Syncfusion.JavaScript.Models.ReportViewer.ReportDataSource reportDatasource = new Syncfusion.JavaScript.Models.ReportViewer.ReportDataSource();
      * reportDatasource.Name = "Sales";
      * reportDatasource.Value = SalesDetails.GetData();
      * datasources.Add(reportDatasource);
      * ViewData["DataSource"] = datasources;
      */
     ViewData["DataSource"] = SalesDetails.GetData();
     return(View());
 }
Beispiel #2
0
        public ActionResult GroupingAggregate(string writerFormat)
        {
            try
            {
                string       fileName = null;
                WriterFormat format;
                HttpContext  httpContext  = System.Web.HttpContext.Current;
                ReportWriter reportWriter = new ReportWriter();
                reportWriter.ReportProcessingMode = ProcessingMode.Local;
                reportWriter.ReportPath           = Server.MapPath("~/App_Data/Reports/KnockOut.rdlc");
                reportWriter.DataSources          = new ReportDataSourceCollection {
                    new ReportDataSource {
                        Name = "Sales", Value = SalesDetails.GetData()
                    }
                };

                if (writerFormat == "PDF")
                {
                    fileName = "GroupingAggregate.pdf";
                    format   = WriterFormat.PDF;
                }
                else if (writerFormat == "Word")
                {
                    fileName = "GroupingAggregate.doc";
                    format   = WriterFormat.Word;
                }
                else if (writerFormat == "Html")
                {
                    fileName = "GroupingAggregate.Html";
                    format   = WriterFormat.HTML;
                }
                else
                {
                    fileName = "GroupingAggregate.xls";
                    format   = WriterFormat.Excel;
                }
                reportWriter.Save(fileName, format, httpContext.Response);
            }
            catch { }

            return(View());
        }