How can I set different types of format (i.e percentage, general, Numeric with 2 or 3 decimal places) and style for different cells in same worksheet? I used following code to set different format for different cell, but it applies whatever format I set in the last cell to all cells in the worksheet.
HSSFCellStyle cellStyle = cell.getCellStyle(); if(formatType == 1) cellStyle.setDataFormat((short)1); //Format --> "0" else if(formatType == 4) cellStyle.setDataFormat((short)4); //Format --> "#,##0.00" else if(formatType == 0xa) cellStyle.setDataFormat((short)0xa); //Format --> "0.00%" else if(formatType == 0x11) cellStyle.setDataFormat((short)0xa); //Format --> "mmm-yy" else cellStyle.setDataFormat((short)0); //Format --> General I noticed that createCellStyle <file:///C:\Lukens\TVA\Jakarta%20-%20POI%201.5.1\poi-bin-2.0-pre3-200307 28\docs\apidocs\org\apache\poi\hssf\usermodel\HSSFWorkbook.html#createCe llStyle()> () and createDataFormat <file:///C:\Lukens\TVA\Jakarta%20-%20POI%201.5.1\poi-bin-2.0-pre3-200307 28\docs\apidocs\org\apache\poi\hssf\usermodel\HSSFWorkbook.html#createDa taFormat()> () API only available in the HSSFWorkbook class. If each cell can have its own format and style, shouldn't these API be in HSSFCell class? Thanks in advance. Prashant Patel