I've just committed a fix. You can get if from CVS. Shawn
-----Original Message----- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Sancho Chiang Sent: Sunday, May 08, 2005 8:13 PM To: [email protected] Subject: Re: Problem on custom format on existing worksheet Shawn Laubach <shawnlaubach <at> cox.net> writes: > > If you could create a bug and give a test piece of code and a sample spread > sheet, it would help us track all of this down. > > Shawn public static void main(String[] args) throws Exception{ InputStream input = new FileInputStream("players.xls"); POIFSFileSystem fs = new POIFSFileSystem(input); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheet("Sheet1"); HSSFRow row = sheet.createRow(sheet.getLastRowNum()+1); HSSFCell cell = row.createCell((short)0); HSSFCellStyle cellStyle= wb.createCellStyle(); HSSFDataFormat dataFormat = wb.createDataFormat(); short format = dataFormat.getFormat("dd/mm/yyyy"); System.out.println("excelFormat::"+format); cellStyle.setDataFormat(format); cell.setCellStyle(cellStyle); cell.setCellValue(new Date()); FileOutputStream fileOut = new FileOutputStream("players.xls"); wb.write(fileOut); fileOut.close(); } This is the code I used. What the code is trying to do is to append the date to the first cell in the next avaiable row. At the begining, the "players.xls" is just an empty spreadsheet. It works perfectly fine at the very first time(i.e for an empty sheet). That means the content in cell "A1" is a formatted date. However, after I ran the code for the second time, the newly added content in the cell "B1" is a numeric value instead of a fomatted date. Is there anything wrong with my code? Thx a lot. Regards, Sancho Chiang --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
