Hi Aostarit,
<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> doc = new Document(MyDir
- “in.docx”);<o:p></o:p>
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
// We want to merge the range of cells found inbetween these two cells.
Cell cellStartRange = table.Rows[0].Cells[0];
Cell cellEndRange = table.Rows[0].Cells[1];
HorizontallyMergeCells(cellStartRange, cellEndRange);
doc.Save(MyDir + "out.docx");
private static void HorizontallyMergeCells(Cell c1, Cell c2)
{
c1.CellFormat.HorizontalMerge = CellMerge.First;
//Move all content from next cell to previous
foreach (Node child in c2.ChildNodes)
c1.AppendChild(child);
c2.CellFormat.HorizontalMerge = CellMerge.Previous;
}
private static void VerticallyMergeCells(Cell c1, Cell c2)
{
c1.CellFormat.VerticalMerge = CellMerge.First;
//Move all content from bottom cell to top
foreach (Node child in c2.ChildNodes)
c1.AppendChild(child);
c2.CellFormat.VerticalMerge = CellMerge.Previous;
}
http://docs.aspose.com/display/wordsnet/Working+with+Merged+Cells