I have no idea what the problem may be - I do not have the Excel file at hand - but suspect there is some feature of the workbook HSSF is unsure about. As a test can you use HSSF to simply create a copy of the workbook - open it and then save it to a new name/location then see if HSSF has similarly mangled the file?
--- On Sat, 10/4/08, nileshkhavat <[EMAIL PROTECTED]> wrote: From: nileshkhavat <[EMAIL PROTECTED]> Subject: Re: How to update cell(s) in excel files ? To: [email protected] Date: Saturday, October 4, 2008, 12:28 AM Hi, I have also used objects in the sheet. nileshkhavat wrote: > > ------------------------------------------------------------------------------------ > Hi, > > I have a excel file with many sheets in it. > It has various formulas, colors and dropdowns in it. > Colors and dropdowns are populated by VB MACROS. > I have tried to update a cell in it by code. > > POIFSFileSystem fs = new POIFSFileSystem(new > FileInputStream("c:\\Try.xls")); > HSSFWorkbook wb = new HSSFWorkbook(fs); > HSSFSheet sheet = wb.getSheet("Try Sheet"); > HSSFRow row = sheet.getRow(3); > HSSFCell cell = row.getCell((short) 2); > > if (cell == null) { > cell = row.createCell((short) 2); > } > > cell.setCellType(HSSFCell.CELL_TYPE_STRING); > HSSFRichTextString str = new HSSFRichTextString("My Project > Name"); > cell.setCellValue(str); > > FileOutputStream fileOut = new > FileOutputStream("c:\\Try.xls"); > wb.write(fileOut); > fileOut.close(); > > > After executing above code following happens > -excel file gets damaged. > -it shows only text contents in sheet. > -all colors, dropdowns disapears in sheet. > -some sheets totally absent. > > Please suggest me the solution over it. > > ------------------------------------------------------------------------------------ > -- View this message in context: http://www.nabble.com/How-to-update-cell%28s%29-in-excel-files---tp19738477p19809753.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
