/** * Performs a second pass over all cells to handle cell row/column spanning. */ protected internal void HandleCellSpanning() { RtfCell deletedCell = new RtfCell(true); for (int i = 0; i < this.cells.Count; i++) { RtfCell rtfCell = (RtfCell)this.cells[i]; if (rtfCell.GetColspan() > 1) { int cSpan = rtfCell.GetColspan(); for (int j = i + 1; j < i + cSpan; j++) { if (j < this.cells.Count) { RtfCell rtfCellMerge = (RtfCell)this.cells[j]; rtfCell.SetCellRight(rtfCell.GetCellRight() + rtfCellMerge.GetCellWidth()); rtfCell.SetCellWidth(rtfCell.GetCellWidth() + rtfCellMerge.GetCellWidth()); this.cells[j] = deletedCell; } } } if (rtfCell.GetRowspan() > 1) { ArrayList rows = this.parentTable.GetRows(); for (int j = 1; j < rtfCell.GetRowspan(); j++) { RtfRow mergeRow = (RtfRow)rows[this.rowNumber + j]; if (this.rowNumber + j < rows.Count) { RtfCell rtfCellMerge = (RtfCell)mergeRow.GetCells()[i]; rtfCellMerge.SetCellMergeChild(rtfCell); } if (rtfCell.GetColspan() > 1) { int cSpan = rtfCell.GetColspan(); for (int k = i + 1; k < i + cSpan; k++) { if (k < mergeRow.GetCells().Count) { mergeRow.GetCells()[k] = deletedCell; } } } } } } }