easypoi 如何合并相同的列,如何在Java中的POI中使用XWPFTable合并单元格(或应用colspan)?...
Creating a table in poi was quite easy but it has very limited tutorials and I cannot find one that can create a simple merged cell in a table in generating a docx file.
解决方案
If you have created table, row inside a table and cell inside a row, you can add gridSpan to cell properties:
if (cell.getCTTc().getTcPr() == null) cell.getCTTc().addNewTcPr();
if (cell.getCTTc().getTcPr().getGridSpan() == null) cell.getCTTc().getTcPr().addNewGridSpan();
cell.getCTTc().getTcPr().getGridSpan().setVal(2);
Note: cell is org.apache.poi.xwpf.usermodel.XWPFTableCell.
总结
以上是生活随笔为你收集整理的easypoi 如何合并相同的列,如何在Java中的POI中使用XWPFTable合并单元格(或应用colspan)?...的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 大宗折价交易意味着什么
- 下一篇: java斐波那切数列_Java中的递归方