/// <summary> /// add the rows of the input report to the rows of this report. /// </summary> /// <param name="report"></param> public void Append(DataItemReport report) { // if this report does not have columns, copy the columns of the append report. if (this.Columns.Count == 0) { this.Columns = report.Columns.ToList(); } // combine the report columns of the two input reports. this.Rows.AddRange(report.Rows); }
public static DataItemReport CombineHorizontally(DataItemReport report1, DataItemReport report2) { var combo = new DataItemReport(); if (report1.IsEmpty()) { combo = report2.Copy(); } else if (report2.IsEmpty()) { combo = report1.Copy(); } else { // report has columns but no rows. add a row with empty items. if (report1.Rows.Count == 0) { var dummy = report1.Copy(); dummy.AddEmptyRow(); report1 = dummy; } if (report2.Rows.Count == 0) { var dummy = report2.Copy(); dummy.AddEmptyRow(); report2 = dummy; } // combine the colummns. combo.AddColumns(report1); combo.AddColumns(report2); // combine rows. foreach (var row1 in report1.Rows) { foreach (var row2 in report2.Rows) { var comboRow = new DataItemList(); comboRow.AddRange(row1); comboRow.AddRange(row2); combo.Rows.Add(comboRow); } } } return(combo); }
/// <summary> /// return a copy of this report. /// </summary> /// <returns></returns> public DataItemReport Copy( ) { var report = new DataItemReport(); // copy the columns. foreach (var col in this.Columns) { report.Columns.Add(col); } // copy the rows foreach (var row in this.Rows) { report.Rows.Add(row); } return(report); }
public static DataItemReport CombineVertically(DataItemReport report1, DataItemReport report2) { var combo = new DataItemReport(); // set the columns of the combined reports to the columns of either report1 // or report 2. combo.AddColumns(report1); if (combo.Columns.Count == 0) { combo.AddColumns(report2); } // combine the report columns of the two input reports. combo.AddRows(report1); combo.AddRows(report2); return(combo); }
public void AddRows(DataItemReport from) { this.Rows.AddRange(from.Rows); }
public void AddColumns(DataItemReport from) { this.Columns.AddRange(from.Columns); }