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)?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大宗折价交易意味着什么
- 下一篇: 浦发白金卡额度是多少