I am reading in an existing spreadsheet (with formulas) and looping through it 
row by row.  Some rows I am deleting and others I am leaving alone.  When I 
save the updated spreadsheet, the formulas in the remaining rows show =#REF!  
All I am doing is reading in rows and deleting them if I find a certain cell 
has a certain value.  The cell I am reading does not have a formula.  I am not 
writing any new data to the sheet, just deleting rows.  Additionally, Excel 
says: File error: data may have been lost.

Any ideas why this is?  
Here is some code:

// loop through range
for(int i=(this.startRow-1); i<=(this.endRow-1); i++){
        tempRow = sheet.getRow(i);
        if(tempRow!=null){
                tempCell = tempRow.getCell(columnIndex);
                if(tempCell != null){
                        try {
                                tempString = tempCell.getStringCellValue();
                        } catch(NumberFormatException ex) {
                                logger.error(ex);
                                tempString = "" + 
(int)tempCell.getNumericCellValue();
                        }
                        value = tempString.toUpperCase();
                                                
                        
                        if(!bonds.containsKey(value)){
                                // Bond was found, delete row
                                sheet.removeRow(tempRow);
                                        
                        }
                }
        }
}

---------------------------------------------------------------------
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/

Reply via email to