AODL.Document.Content.Tables.Row.MergeCells C# (CSharp) Method

MergeCells() public method

Merge cells. This is only possible if the rows table is part of a text document.
public MergeCells ( AODL document, int cellStartIndex, int mergeCells, bool mergeContent ) : void
document AODL The TextDocument this row belongs to.
cellStartIndex int Start index of the cell.
mergeCells int The count of cells to merge incl. the starting cell.
mergeContent bool if set to true [merge content].
return void
		public void MergeCells(AODL.Document.TextDocuments.TextDocument document,int cellStartIndex, int mergeCells, bool mergeContent)
		{
			try
			{
				this.Cells[cellStartIndex].ColumnRepeating		= mergeCells.ToString();
				
				if (mergeContent)
				{
					for(int i=cellStartIndex+1; i<cellStartIndex+mergeCells; i++)
					{
						foreach(IContent content in this.Cells[i].Content)
							this.Cells[cellStartIndex].Content.Add(content);
					}
				}

				for(int i=cellStartIndex+mergeCells-1; i>cellStartIndex; i--)
				{
					this.Cells.RemoveAt(i);
					this.CellSpanCollection.Add(new CellSpan(this, (AODL.Document.TextDocuments.TextDocument)this.Document));
				}
			}
			catch(Exception)
			{
				throw;
			}
		}