示例#1
0
        private static void MergeCellsInColumn(int col)
        {
            TableCell tCell;

            TableCellProperties tcPropStart = new TableCellProperties();

            tcPropStart.Append(new VerticalMerge()
            {
                Val = MergedCellValues.Restart
            });

            TableCellProperties tcPropNext = new TableCellProperties();

            tcPropNext.Append(new VerticalMerge()
            {
                Val = MergedCellValues.Continue
            });

            foreach (TableRow tRow in tab.Elements <TableRow>())
            {
                tCell = tRow.Elements <TableCell>().ElementAt(col);

                if (IsEmptyCell(tCell))
                {
                    tCell.Append(tcPropNext.CloneNode(true));
                }
                else
                {
                    tCell.Append(tcPropStart.CloneNode(true));
                }
            }
        }