code: public static void mergeCellsVertically(XWPFTable table, int col, int fromRow, int toRow) {
          if (toRow <= fromRow) return;
          for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
              XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
              CTTcPr tcPr = getTcPr(cell);
              CTVMerge vMerge = tcPr.addNewVMerge();
              if (rowIndex == fromRow) {
                  // The first merged cell is set with RESTART merge value
                  vMerge.setVal(STMerge.RESTART);
              } else {
                  // Cells which join (merge) the first one, are set with CONTINUE
                  vMerge.setVal(STMerge.CONTINUE);
              }
          }
      }
docs: 合并列单元格
  
  @param table
  表格对象
  @param col
  列 从0开始
  @param fromRow
  起始行
  @param toRow
  结束行