/// <summary> /// Clone the element. /// </summary> public override Element Clone() { // create a new element table ElementTable clone = new ElementTable(); clone.Tag = this.Tag; if (this._content != null) { clone._content = new ArrayRig <string>(this._content); } if (this._attributes != null) { clone._attributes = new Dictionary <string, string>(this._attributes); } if (this._style != null) { clone._style = new Style(this._style); } // have the columns been assigned? if (this._columnGroup != null) { // yes, create the collection var columnsRow = new Row(clone); clone.ColumnGroup = columnsRow; // clone the row element columnsRow.RowElement = _columnGroup.RowElement.Clone(); // iterate the rows children foreach (var cell in _columnGroup.RowElement.Children) { if (cell.Tag == Tag.Column) { clone.ColumnGroup.Cells.Add(cell); } } } if (_header != null) { // create a new row var headerRow = new Row(clone); clone.Header = headerRow; // clone the row element headerRow.RowElement = _header.RowElement.Clone(); // iterate the rows children foreach (var cell in _header.RowElement.Children) { if (cell.Tag == Tag.TableHeadCell) { clone.Header.Cells.Add(cell); } } } // iterate the rows foreach (var row in _rows) { // create a new row var cloneRow = new Row(clone); clone._rows.Add(cloneRow); // clone the row element cloneRow.RowElement = row.RowElement.Clone(); // iterate the rows children foreach (var cell in cloneRow.RowElement.Children) { if (cell.Tag == Tag.TableCell) { cloneRow.Cells.Add(cell); } } } return(clone); }
/// <summary> /// Create the row for the specified table. /// </summary> public Row(ElementTable table) { Table = table; Cells = new ArrayRig <Element>(Table._columnCount); }