problem with poi and row height

M

maxime_phan

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top