不会吧,你分别对不同的cell设定格式就可以了

解决方案 »

  1.   

    我用过POI,但只是简单的用一下,也许POI还没有领会OLE2的全部?
      

  2.   

    yuechun(加密狗),你用好使么?
    我的代码:
    row  = sheet.createRow(0);
    cell_0 = row.createCell((short)6);
    cell_0.setEncoding((short)HSSFCell.ENCODING_UTF_16);
    cell_0.setCellValue("我是我是");
    font.setFontHeightInPoints((short)24);
    style.setFont( font );
    cell_0.setCellStyle(style);row  = sheet.createRow(1);
    cell_1 = row.createCell((short)0);
    cell_1.setEncoding((short)HSSFCell.ENCODING_UTF_16);
    cell_1.setCellValue("难道你现在");
    font.setFontHeightInPoints((short)12);
    style.setFont( font );
    cell_1.setCellStyle(style);然后,字体就都变成12了!不知道为什么?
      

  3.   

    这说明你对java还不是很了解
    //此处你new 一个Style
    row  = sheet.createRow(0);
    cell_0 = row.createCell((short)6);
    cell_0.setEncoding((short)HSSFCell.ENCODING_UTF_16);
    cell_0.setCellValue("我是我是");
    font.setFontHeightInPoints((short)24);
    style.setFont( font );
    cell_0.setCellStyle(style);//这个地方你再new  style
    row  = sheet.createRow(1);
    cell_1 = row.createCell((short)0);
    cell_1.setEncoding((short)HSSFCell.ENCODING_UTF_16);
    cell_1.setCellValue("难道你现在");
    font.setFontHeightInPoints((short)12);
    style.setFont( font );
    cell_1.setCellStyle(style);你原来的两个单元格的style其实是指向了同一个内存地址,所以他们的格式都是一样的