Beispiel #1
0
 public byte[] GetRunExcelReport(ExcelReportRunModel run)
 {
     using (var reportBuilder = new ExcelReportBuilder(new ExcelStyleApplier()))
     {
         reportBuilder.PredefineStyles(GamePlanReportStyles.RunReportPredefineStyles);
         foreach (var scenario in run.Scenarios)
         {
             reportBuilder.Sheet(scenario.Name, sb =>
             {
                 var columnsCount = scenario.MaxColumnsCount;
                 SetColumnsWidthForRunReport(sb, columnsCount);
                 WriteGrid(sb, scenario.ScenarioDetails);
                 sb.Skip();
                 WriteGrid(sb, scenario.SalesAreaPassPriorities);
                 sb.Skip();
                 WriteGrid(sb, scenario.General);
                 sb.Skip();
                 WriteGrid(sb, scenario.Weighting);
                 sb.Skip();
                 WriteGrid(sb, scenario.Tolerance);
                 sb.Skip();
                 WriteGrid(sb, scenario.Rules);
                 sb.Skip();
                 WriteGrid(sb, scenario.ProgrammeRepetitions);
                 sb.Skip();
                 WriteGrid(sb, scenario.MinRatingPoints);
                 sb.Skip();
                 WriteGrid(sb, scenario.BreakExclusions);
                 sb.Skip();
                 WriteGrid(sb, scenario.SlottingLimits);
             });
         }
         return(reportBuilder.Save());
     }
 }
        public byte[] GetReportAsByteArray(string sheetName,
                                           IEnumerable <CampaignReportModel> data,
                                           IEnumerable <ColumnStatusModel> columnStatusList,
                                           IReportColumnFormatter reportColumnHelper)
        {
            var confBuilder = CreateExcelConfigurationBuilder();

            using (var reportBuilder = new ExcelReportBuilder(new ExcelStyleApplier())
                                       .PredefineStyles(GamePlanReportStyles.AllPredefineStyles))
            {
                var orderedData = reportColumnHelper.ApplySettings(data, columnStatusList, confBuilder);

                reportBuilder.Sheet(sheetName, sheetBuilder =>
                {
                    sheetBuilder.DataContent(orderedData, confBuilder.BuildConfiguration());
                    reportColumnHelper.AutoFitAll(sheetBuilder);
                });
                return(reportBuilder.Save());
            }
        }