使用apache POI在excel文件中创建带有两行的标头(Creating a header with two line in excel file with apache POI)

编程入门 行业动态 更新时间:2024-10-09 05:23:44
使用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.

更多推荐

本文发布于:2023-08-04 19:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1419202.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两行   文件   POI   excel   apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!