关于java生成Excel文件时合并单元格出现的问题

_超级赛亚人_ _超级赛亚人_ 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在用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.
求解!!!
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
_超级赛亚人_
Java EE 67,535 成员 225,843 内容