code: public static void mergeCellsHorizonal(XWPFTable table, int row, int fromCol, int toCol) {
          if (toCol <= fromCol) return;
          XWPFTableCell cell = table.getRow(row).getCell(fromCol);
          CTTcPr tcPr = getTcPr(cell);
          XWPFTableRow rowTable = table.getRow(row);
          for (int colIndex = fromCol + 1; colIndex <= toCol; colIndex++) {
              rowTable.getCtRow().removeTc(fromCol + 1);
              rowTable.removeCell(fromCol + 1);
          }
  
          tcPr.addNewGridSpan();
          tcPr.getGridSpan().setVal(BigInteger.valueOf((long) (toCol - fromCol + 1)));
      }
docs: 合并行单元格
  
  @param table
  表格对象
  @param row
  行 从0开始
  @param fromCol
  起始列
  @param toCol
  结束列