Пример #1
0
        private void AddFooterRow(ReportRowCollection rows)
        {
            if (_decTotals.Count > 0)
            {
                var footerRow = new ReportRow(ReportRowType.FooterRow, DataFields, Source, null);
                foreach (KeyValuePair <RowField, decimal> total in _decTotals)
                {
                    footerRow[total.Key] = string.Format(total.Key.DataFormatString, total.Value);
                }

                foreach (ReportField field in DataFields)
                {
                    if (!string.IsNullOrEmpty(field.FooterText))
                    {
                        footerRow[field.Name] = field.FooterText;
                    }
                }

                rows.Add(footerRow);
            }
        }
Пример #2
0
        public virtual ReportRowCollection GetRows()
        {
            var rows = new ReportRowCollection();

            rows.RowAdding += RenderingRow;

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

            rows.Add(headerRow);

            foreach (object dataItem in Source.GetItems())
            {
                var row = new ReportRow(ReportRowType.DataRow, DataFields, Source, dataItem);
                AddTotalsIfRowSupports(row);

                rows.Add(row);
            }

            AddFooterRow(rows);

            return(rows);
        }