我用的是poi-3.5-FINAL-20090928.jar我用poi做数据导出到excel时,需要合并一些单元格
请问怎么实现?

解决方案 »

  1.   

    呵呵,前些天刚好做过一个类似的东西,调用一个方法就可以,给你点示例代码sheet.addMergedRegion(new Region(k-columnCount-1,(short)0,k-1,(short)0));\具体的参数用法可以看api,写的很详细
    我这个是合并第一列的columnCount行
      

  2.   


    我写了:sheet.addMergedRegion(new Region(0,(short)0,0,(short)3));
    这一行下面打了黄钱波浪线,addMergedRegion上面也画了一杠黑钱
    提示:
    the method addMergedRegion(Region) from the type HSSFSheet is deprecated.
    这个方法不支持使用
    现在是用什么方法来代替了吧
    请问有谁知道呀?
      

  3.   

    问题已经解决sheet.addMergedRegion(new CellRangeAddress(0,0,0,3))
    /*
    *CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) 
    */