POI导出word单元格合并
程序员文章站
2022-06-14 09:10:30
...
1、跨列合并
//合并单元格
for (int cellIndex = 2; cellIndex <= 3; cellIndex++) {
XWPFTableCell cellMerge = row.getCell(cellIndex);
if ( cellIndex == 2 ) {
// The first merged cell is set with RESTART merge value
cellMerge.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);
} else {
// Cells which join (merge) the first one, are set with CONTINUE
cellMerge.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
}
}
上一篇: kafka集群环境的搭建
下一篇: PHP中文乱码问题