1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
public void createRow(NSArray cellValues,int numRow,int startColumn)
{
HSSFRow aRow= fSheet.createRow((short)numRow);
HSSFCellStyle cellStyle = fWorkbook.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
for(int i= 0, iLimit= cellValues.count(); i < iLimit; i++)
{
short numCol= (short) (i+startColumn);
String cellValue= (String)cellValues.objectAtIndex(i);
HSSFCell aCell= aRow.createCell(numCol);
aCell.setCellValue(cellValue);
aCell.setCellStyle(cellStyle);
//Calculate cell width
int width = cellValue.length();
if(width > fSheet.getColumnWidth(numCol))
fSheet.setColumnWidth(numCol, (short)width);
}
} |
Partager