problem with poi and row height

Discussion in 'Java' started by maxime_phan@hotmail.com, Oct 19, 2007.

  1. Guest

    hello everybody,
    I using POI to generate some report, and here my problem with my code:

    row.createCell((short)2);HSSFUtils.createCell(row, (short)2,
    CoordResponsable, cellStyle);
    HSSFUtils.mergeCell(sheet, 8+i, (short)2, (short)4, cellStyle,
    CoordResponsable);

    with the function:
    public static void mergeCell(HSSFSheet sheet, int iRow, short
    startCell,
    short endCell, HSSFCellStyle style, String value) {
    HSSFRow row = sheet.getRow(iRow);
    if (row==null) {
    return;
    }
    sheet.addMergedRegion(new Region(iRow, startCell, iRow, endCell));
    if (style!=null) {
    row.getCell(startCell).setCellStyle(style);
    }
    if (value!=null) {
    row.getCell(startCell).setCellValue(value);
    }
    }

    public static HSSFCell createCell(HSSFRow row, short iPos, String
    value, HSSFCellStyle cellStyle) {
    HSSFCell cell = row.createCell(iPos);
    cell.setCellValue(value);
    cell.setCellStyle(cellStyle);
    return cell;
    }

    in my cellstyle i have cellStyle.setWrapText(true);

    when i do :
    HSSFUtils.mergeCell(sheet, 8+i, (short)2, (short)4, cellStyle,
    CoordResponsable);

    my variable CoordResponsable is a string with many line
    but the merged cell doesn't fit the data(the data are in the cell but
    you can only see the first line and you have to click on the cell to
    see all, I would like the row's height fit automatically with the
    number of line)

    any idea?
    thanks in advance
     
    , Oct 19, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. [XaToA]
    Replies:
    0
    Views:
    3,447
    [XaToA]
    Jul 29, 2003
  2. W@cek
    Replies:
    0
    Views:
    1,748
    W@cek
    Mar 31, 2005
  3. Samuel
    Replies:
    0
    Views:
    736
    Samuel
    May 25, 2006
  4. Replies:
    0
    Views:
    749
  5. Wotney
    Replies:
    1
    Views:
    696
    Flinky Wisty Pomm
    Oct 25, 2006
  6. tshad
    Replies:
    1
    Views:
    1,893
    bruce barker
    Mar 8, 2007
  7. Edsoncv

    JTable Row Height Problem

    Edsoncv, Feb 19, 2008, in forum: Java
    Replies:
    0
    Views:
    965
    Edsoncv
    Feb 19, 2008
  8. D
    Replies:
    0
    Views:
    512
Loading...