POI Excel合並單元格

POI合并单元格    

 

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("sheet1");
    //合并单元格,从0初始化

    sheet.addMergedRegion(new Region(0,(short)0,0,(short)2));

    HSSFRow rowT = sheet.createRow(0);
    HSSFCell cellT = rowT.createCell((short)0);
    cellT.setEncoding(HSSFCell.ENCODING_UTF_16);
    cellT.setCellValue("标题栏");

 

你可能感兴趣的:(poi)