Hello, I have problem with HSSF component. I use MS Office 2000 (Czech localize). When I read and write workbook: POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("c:\\workbook1.xls")); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheetAt(0); //HSSFSheet sheet1 = wb.getSheetAt(1); HSSFRow row = sheet.getRow(3); HSSFCell cell = row.getCell((short)3); if (cell == null) cell = row.createCell((short) 2); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); cell.setCellValue(80); // Write the output to a file FileOutputStream fileOut = new FileOutputStream("workbook2.xls"); wb.write(fileOut); fileOut.close(); When I open workbook2.xls in MS Excel error occured in MS Excel "Error in file: some number formats may be lost" and some data are losted in last sheet (I have two sheets in workbook- first sheet is OK, but second sheet have some data lost). I try use MS Excel 97, but I get same result. Do you have any idea? Best Regards Pavel
Created attachment 6877 [details] wokbook1.xls (original file), workbook2.xls (corrupt file)
I tried my code (code is in previous comment) in version poi-src-2.0-pre1- 20030517, but I have same problem. For additional, HSSF wrote messages on error output: [WARNING] Unknown Ptg 12 (18) at cell (2,4) [WARNING] Unknown Ptg 12 (18) at cell (3,4) [WARNING] Unknown Ptg 12 (18) at cell (4,4) [WARNING] Unknown Ptg 12 (18) at cell (5,4) [WARNING] Unknown Ptg 12 (18) at cell (2,4) [WARNING] Unknown Ptg 12 (18) at cell (3,4) [WARNING] Unknown Ptg 12 (18) at cell (4,4) [WARNING] Unknown Ptg 12 (18) at cell (5,4)
We need to fix this but supporting some of the various intenational number formats is potentially a lot of work. We need more support from folks with localized versions of Excel. This is a good start. I don't think we can do this by 2.0 though.
Tested with 2.0RC1 and Excel2002. File opens perfectly in Excel, charts, accented text etc all correct.
Created attachment 8891 [details] Correctly re-written file