private void Initialize(RtfTableCellStyle style) { _definition = new RtfTableCellDefinition(this); _definition.Style = style; IsPartOfATable = true; IsFormattingIncluded = style != null && style.DefaultParagraphFormatting != null; }
/// <summary> /// Merge the cell located at the intersection of the column and row with the specified indexes horizontally with the specified number of cells. /// </summary> /// <param name="columnIndex">The index of the column containing the cell.</param> /// <param name="rowIndex">The index of the row containing the cell.</param> /// <param name="count">The number of cells to merge.</param> public void MergeCellsHorizontally(int columnIndex, int rowIndex, int count) { RtfTableCellDefinition firstDef = this[columnIndex, rowIndex].Definition; firstDef.FirstHorizontallyMergedCellInternal = true; for (int i = 1; i < count && i + columnIndex < Rows[rowIndex].Cells.Count; i++) { RtfTableCellDefinition cellDef = this[i + columnIndex, rowIndex].Definition; cellDef.HorizontallyMergedCellInternal = true; firstDef.Style.CopyTo(cellDef.StyleInternal); } }
/// <summary> /// Merge the cell located at the intersection of the column and row with the specified indexes vertically with the specified number of cells. /// </summary> /// <param name="columnIndex">The index of the column containing the cell.</param> /// <param name="rowIndex">The index of the row containing the cell.</param> /// <param name="count">The number of cells to merge.</param> public void MergeCellsVertically(int columnIndex, int rowIndex, int count) { RtfTableCellDefinition firstDef = this[columnIndex, rowIndex].Definition; firstDef.FirstVerticallyMergedCellInternal = true; for (int i = 1; i < count && i + rowIndex < Rows.Count; i++) { RtfTableCellDefinition cellDef = this[columnIndex, i + rowIndex].Definition; cellDef.VerticallyMergedCellInternal = true; firstDef.Style.CopyTo(cellDef.StyleInternal); cellDef.WidthInternal = firstDef.Width; } }