They aren't though.  The formula cells only reference cells in the same row as 
itself, so deleting rows should be fine.  The sheet is as follows:

CUSIP           NAME                    PRICE1  PRICE2  PRICEDIFF       
02081T9A8       BRANDS REGS             100.25  100.25  0

The PRICEDIFF column is a formula: PRICE1 - PRICE2

-----Original Message-----
From: Anthony Andrews [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 01, 2005 11:07 AM
To: POI Users List
Subject: Re: Deleting rows ruins formulas


I am guessing that one or more of those cells in the
rows you are deleting are referenced by formulae and
that those formulae are in cells on rows that you are
not deleting.

--- "Gordon, Jason [IT]" <[EMAIL PROTECTED]>
wrote:

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



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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

Reply via email to