public static void MergeCellRange(string dataDir)
{
// ExStart:MergeCellRange
// Open the document
Document doc = new Document(dataDir + "Table.Document.doc");
// Retrieve the first table in the body of the first section.
Table table = doc.FirstSection.Body.Tables[0];
// We want to merge the range of cells found inbetween these two cells.
Cell cellStartRange = table.Rows[2].Cells[2];
Cell cellEndRange = table.Rows[3].Cells[3];
// Merge all the cells between the two specified cells into one.
MergeCells(cellStartRange, cellEndRange);
dataDir = dataDir + "Table.MergeCellRange_out.doc";
// Save the document.
doc.Save(dataDir);
// ExEnd:MergeCellRange
Console.WriteLine("\nCells merged successfully.\nFile saved at " + dataDir);
}
public static void PrintHorizontalAndVerticalMerged(string dataDir)