private void ExportTable(ExcelWorksheet workSheet, ReportTable table, ICollection<string> names)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }
            if (workSheet == null)
            {
                throw new ArgumentNullException("workSheet");
            }

            const int firstColumn = 2;
            var firstLine = workSheet.Dimension != null ? workSheet.Dimension.End.Row + 2 : 2;
            var xlWriter = new ExcelWriter(workSheet, firstLine, firstColumn, names.Count);

            xlWriter.PutTableHead(table.Name, names);

            ICollection<int> totalRating = null;
            foreach (var group in table.ReportGroups)
            {
                var groupResults = GenerateGroup(xlWriter, group);
                totalRating = totalRating == null ? groupResults : SummarizeResults(totalRating, groupResults);
            }

            xlWriter.PutTableResults(totalRating);
            xlWriter.SetGlobalStyles();
        }
        private ICollection<int> GenerateGroup(ExcelWriter xlWriter, ReportGroup group)
        {
            ICollection<int> results = null;

            xlWriter.PutGroupHead(group.Name);

            foreach (var reporRow in group.ReportRows)
            {
                var rowResult = GenerateRow(xlWriter, reporRow);
                results = results == null ? rowResult : SummarizeResults(results, rowResult);
            }

            xlWriter.PutGroupResults(results);

            return results;
        }
 private ICollection<int> GenerateRow(ExcelWriter xlWriter, ReportRow reportRow)
 {
     xlWriter.PutResultsRow(reportRow.Name, reportRow.MaxValue, reportRow.Results);
     return reportRow.Results;
 }