Bug 46699

Summary: Unable to modify cell contents in a spreadsheet
Product: POI Reporter: Deepak Premnath <deepak_sathya>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: enhancement CC: krishna81m
Priority: P2    
Version: 3.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Deepak Premnath 2009-02-11 13:23:29 UTC
This is just an enhancement request to make modifications to cell values in an excel spreadsheet relatively easier.
Comment 1 Nick Burch 2009-02-11 15:18:38 UTC
Editing contents of an excel spreadsheet is already fully supported by the hssf usermodel
Comment 2 krishna81m@gmail.com 2010-02-26 15:27:27 UTC
Isn't the following code kind of an over kill to update a single cell in a huge workbook with many sheets?

InputStream inp = new FileInputStream("wb.xls");
    Workbook wb = WorkbookFactory.create(inp);
    Sheet sheet = wb.getSheetAt([sheet index]);
    Row row = sheet.getRow([row index]);
    Cell cell = row.getCell([cell index]);
    String cellContents = cell.getStringCellValue(); 
    //Modify the cellContents here
    // Write the output to a file
    cell.setCellValue(cellContents); 
    FileOutputStream fileOut = new FileOutputStream("wb.xls");
    wb.write(fileOut);
    fileOut.close();
Comment 3 Nick Burch 2010-02-26 15:42:03 UTC
Please ask questions on the list, rather than hijacking old bugs
Comment 4 krishna81m@gmail.com 2010-02-26 18:21:13 UTC
(In reply to comment #3)
> Please ask questions on the list, rather than hijacking old bugs

Hijack old bug? ;) I preferred to use an already requested enhancement (rather than a bug) as asking for an enhancement on a list wouldn't help!

Sure, the title of the enhancement does not make sense to my context, in which case, you could have suggested me to raise a new enhancement or is my question incorrect, that I should ask for a solution on the list?