Specifies how a cell in a table is merged with other cells.
[Visual Basic]
Public Enum CellMerge
[C#]public enum CellMerge
Example
Creates a table with two rows with cells in the first row horizontally merged.
[C#]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertCell();
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.Write("Text in the merged cells.");
builder.InsertCell();
// This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.EndRow();
builder.InsertCell();
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.Write("Text in one cell.");
builder.InsertCell();
builder.Write("Text in another cell.");
builder.EndRow();[Visual Basic]
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.InsertCell()
builder.CellFormat.HorizontalMerge = CellMerge.First
builder.Write("Text in the merged cells.")
builder.InsertCell()
' This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous
builder.EndRow()
builder.InsertCell()
builder.CellFormat.HorizontalMerge = CellMerge.None
builder.Write("Text in one cell.")
builder.InsertCell()
builder.Write("Text in another cell.")
builder.EndRow()Creates a table with two columns with cells merged vertically in the first column.
[C#]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.Write("Text in the merged cells.");
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.Write("Text in one cell");
builder.EndRow();
builder.InsertCell();
// This cell is vertically merged to the cell above and should be empty.
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.Write("Text in another cell");
builder.EndRow();[Visual Basic]
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.InsertCell()
builder.CellFormat.VerticalMerge = CellMerge.First
builder.Write("Text in the merged cells.")
builder.InsertCell()
builder.CellFormat.VerticalMerge = CellMerge.None
builder.Write("Text in one cell")
builder.EndRow()
builder.InsertCell()
' This cell is vertically merged to the cell above and should be empty.
builder.CellFormat.VerticalMerge = CellMerge.Previous
builder.InsertCell()
builder.CellFormat.VerticalMerge = CellMerge.None
builder.Write("Text in another cell")
builder.EndRow()Members
| Member Name | Description | Value |
| None | The cell is not merged. | 0 |
| First | The cell is the first cell in a range of merged cells. | 1 |
| Previous | The cell is merged to the previous cell horizontally or vertically. | 2 |
Requirements
Namespace: Aspose.Words.Tables
Assembly: Aspose.Words (in Aspose.Words.dll)
See Also
Aspose.Words.Tables Namespace