Пример #1
0
        public virtual ReportRowCollection GetRows()
        {
            var rows = new ReportRowCollection(this);

            rows.RowAdding += RenderingRow;

            var headerRow = new ReportRow(this, ReportRowType.HeaderRow, null);

            rows.Add(headerRow);

            foreach (var dataItem in Source.GetItems())
            {
                var row = new ReportRow(this, ReportRowType.DataRow, dataItem);
                AddTotalsIfRowSupports(row);
                rows.Add(row);
            }

            AddFooterRow(rows);

            return(rows);
        }
Пример #2
0
        private void AddFooterRow(ReportRowCollection rows)
        {
            if (_totals.Count == 0)
            {
                return;
            }

            var footerRow = new ReportRow(this, ReportRowType.FooterRow, null);

            foreach (var total in _totals)
            {
                footerRow[total.Key] = string.Format(total.Key.DataFormatString, total.Value);
            }

            foreach (var field in DataFields.Where(field => !string.IsNullOrEmpty(field.FooterText)))
            {
                footerRow[field.Name] = field.FooterText;
            }

            rows.Add(footerRow);
        }