示例#1
0
        /// <summary>
        /// Merge cells. This is only possible if the rows table is part
        /// of a text document.
        /// </summary>
        /// <param name="document">The TextDocument this row belongs to.</param>
        /// <param name="cellStartIndex">Start index of the cell.</param>
        /// <param name="mergeCells">The count of cells to merge incl. the starting cell.</param>
        /// <param name="mergeContent">if set to <c>true</c> [merge content].</param>
        public void MergeCells(TextDocument document, int cellStartIndex, int mergeCells, bool mergeContent)
        {
            Cells[cellStartIndex].ColumnRepeating = mergeCells.ToString();

            if (mergeContent)
            {
                for (int i = cellStartIndex + 1; i < cellStartIndex + mergeCells; i++)
                {
                    foreach (IContent content in Cells[i].Content)
                    {
                        Cells[cellStartIndex].Content.Add(content);
                    }
                }
            }

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