使用apache POI在excel文件中创建带有两行的标头(Creating a header with two line in excel file with apache POI)
如何使用apache POI从java代码中获取此标头?
How can I get this header from java code with apache POI?
最满意答案
通常,您可以通过合并所有“Projets”项目的两个单元格来完成此操作。
请参阅https://poi.apache.org/spreadsheet/quick-guide.html#MergedCells
基本上你用这样的调用定义所有合并区域
sheet.addMergedRegion(new CellRangeAddress( 0, //first row (0-based) 0, //last row (0-based) 0, //first column (0-based) 1 //last column (0-based) ));另请参阅使用Apache POI 在POI中 合并和合并Excel中的 单元格后设置单元格值以进行更多讨论。
Usually you do that by merging two cells for all the "Projets" items.
See https://poi.apache.org/spreadsheet/quick-guide.html#MergedCells
Basically you define all the merged areas with calls like this
sheet.addMergedRegion(new CellRangeAddress( 0, //first row (0-based) 0, //last row (0-based) 0, //first column (0-based) 1 //last column (0-based) ));See also Setting value to cells after merging in POI and Merging cells in Excel using Apache POI for more discussion around this.
更多推荐
发布评论