在用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.
求解!!!

解决方案 »

  1.   

    警告:有超过一列的数据列,将其它的(未处理的)数据列设置为空。
    解释下这句:ws.mergeCells(0, 0, 10, 3); 
    我好给你检查下。
      

  2.   

    在用java生成Excel中合并单元格时代码如下:(截取出去Warning的部分)
    for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 10; j++) {
    ws.addCell(new Label(j, i, "标题", center));
    }
    }
    i从0到3,j从0到9.一共也才4*10=40
      

  3.   

    恩。。那个是得改成9
    但是我刚才试了下。。为什么我在空白Excel里面合并两个单元格的时候也会出现那个警告
    怎么在合并之后把覆盖的单元格置成blank
      

  4.   

    坦白说这个类我没用过。你可以找下它的API
      

  5.   

    还是谢谢你哈我重新用POI插件做了。。但是上面的问题还是没解决。。再有就是:请问下导出(Excel或则dbf文件)我在火狐下都好使,但是在IE下就是不弹出保存框,后台也不报错,请问怎么解决
      

  6.   

    不兼容你的IE版本啊。你查看下插件说明。针对哪些浏览器有效。IE也有分版本的 例如IE6,7,8