public SourceTable MergeAsRows(SourceTable other, Boolean OnlyDistinct = false) { var thisRows = GetContentByRows(); var otherRows = other.GetContentByRows(); //var allRows = new List<List<String>>(); //allRows.AddRange(thisRows); //allRows.AddRange(otherRows); //if (OnlyDistinct) allRows = TakeDistinct(allRows); //SourceTable output = new SourceTable(Width, allRows.Count); SourceTable output = SourceTableExtensions.Merge(new List <List <List <String> > >() { thisRows, otherRows }, false, OnlyDistinct); //new SourceTable(allColumns.Count, Height); //for (int i = 0; i < output.Height; i++) //{ // var row = allRows[i]; // //List<SourceTableCell> row = new List<SourceTableCell>(); // for (int j = 0; j < output.Width; j++) // { // if (j < row.Count()) // { // output[j, i].Value = row[j]; // } // // SourceTableCell cell = new SourceTableCell(); // //row.Add(cell); // } // //Cells.Add(row); //} return(output); }
public SourceTable MergeAsColumns(SourceTable other, Boolean OnlyDistinct = false) { var thisColumns = GetContentByColumns(); var otherColumns = other.GetContentByColumns(); //var allColumns = new List<List<String>>(); //allColumns.AddRange(thisColumns); //allColumns.AddRange(otherColumns); //if (OnlyDistinct) allColumns = TakeDistinct(allColumns); SourceTable output = SourceTableExtensions.Merge(new List <List <List <String> > >() { thisColumns, otherColumns }, true, OnlyDistinct); // new SourceTable(allColumns.Count, Height); //for (int i = 0; i < output.Width; i++) //{ // var column = allColumns[i]; // //List<SourceTableCell> row = new List<SourceTableCell>(); // for (int j = 0; j < output.Height; j++) // { // if (j < column.Count) // { // output[i, j].Value = column[j]; // } // // SourceTableCell cell = new SourceTableCell(); // //row.Add(cell); // } // //Cells.Add(row); //} return(output); }