关于java生成Excel文件时合并单元格出现的问题
在用java生成Excel中合并单元格时代码如下:(截取出去Warning的部分)
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
ws.addCell(new Label(j, i, "标题", center));
}
}
ws.mergeCells(0, 0, 10, 3);// 合并单元格
for (int i = 0; i < 11; i++) {
if (i < 7) {
ws.addCell(new Label(i, 4, "", center));
} else {
ws.addCell(new Label(i, 4, "学位办公室制", center));
}
}
ws.mergeCells(7, 4, 10, 4);
但是会有这样的Warning:
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range H5-K5 contains more than one data cell. Setting the other cells to blank.
Warning: Range H5-K5 contains more than one data cell. Setting the other cells to blank.
Warning: Range H5-K5 contains more than one data cell. Setting the other cells to blank.
求解!!!
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
ws.addCell(new Label(j, i, "标题", center));
}
}
ws.mergeCells(0, 0, 10, 3);// 合并单元格
for (int i = 0; i < 11; i++) {
if (i < 7) {
ws.addCell(new Label(i, 4, "", center));
} else {
ws.addCell(new Label(i, 4, "学位办公室制", center));
}
}
ws.mergeCells(7, 4, 10, 4);
但是会有这样的Warning:
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range A1-K4 contains more than one data cell. Setting the other cells to blank.
Warning: Range H5-K5 contains more than one data cell. Setting the other cells to blank.
Warning: Range H5-K5 contains more than one data cell. Setting the other cells to blank.
Warning: Range H5-K5 contains more than one data cell. Setting the other cells to blank.
求解!!!
...全文
相关推荐
利用easyExcel导出上万条数据,自定义策略合并单元格
首先,EasyExcel是一个轻量级的Java Excel处理工具,它主要解决了Apache POI在处理大数据时的内存消耗问题。
java excel tree
在Excel中,合并单元格可以用于美化报表,特别是在展示组织结构时,通常会使用合并单元格来表示层次关系。
【EasyExcel】解决模板导出时,合并单元格样式丢失
这主要是因为在使用模板生成Excel文件时,EasyExcel默认可能并不支持模板中原有的某些高级样式,尤其是涉及合并单元格时。为了解决合并单元格样式丢失的问题,我们需要关注几个关键的处理点。
jxl操作不规范的excel文档
JXL是一个Java库,专门用于读写Microsoft Excel文件,它为Java开发者提供了一种方便的方式来操作Excel文档。
EasyExcel合并单元格导出[代码]
EasyExcel是一个Java编写的Excel处理框架,它能够高效地导出Excel文件。在实际开发过程中,合并单元格是常见的需求之一,尤其是在生成复杂报告或者需要数据可视化的场景中。


