Summary: | [PATCH]Cloning Sheets: Formula Problems | ||
---|---|---|---|
Product: | POI | Reporter: | Niall Pemberton <niall.pemberton> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.0-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | other | ||
Attachments: |
Patch to correct cloning issues
Replacement Patch with additional bug fix |
Description
Niall Pemberton
2003-06-23 19:55:16 UTC
Created attachment 6944 [details]
Patch to correct cloning issues
Created attachment 6981 [details]
Replacement Patch with additional bug fix
Thanks, will add them in soon I probably should have given a better description of the problems this caused. Because these classes were not cloning the ptgClass attribute, when the spreadsheet is opened in Excel the cells with the affected functions have #VALUE! errors. I have also just uploaded another patch, which has all the original changes plus the following changes to the FunctionRecord class: 1) data_value is not being copied in FunctionRecord.clone(). This causes a problem when the result is a "Empty" cell - openning the file in Excel causes a message "File Error: data may have been lost" to be displayed. In actual fact Nothing had been lost and saving the file sorted this out - doesn't look good to the users though. 2) When the calculated value of a Formula is not a number the FormulaRecord.toString() just shows "NaN" - however the 8 bytes contain important information. When I used biffviewer, it took me a long time to work out the above problem because I couldn't see it. I have changed the toString() to display a hex dump if its not a number. I was just typing this in when you said your going to apply them - thanks much appreciated. Niall Whats functionrecord? do you mean formularecord? And why is that a problem with an empty cell? Other than that, the patch itself seems fine, so i am applying now! Sorry, yes it should have been "FormulaRecord" not "FunctionRecord". The data_value contains the results of the formula which is either 1) a number 2) an identifier for a String value (and a String record should follow) 3) a boolean value or 4) an identifier for an "empty cell". When the result of the formula is an "empty cell" and the indicator (which is in data_value) is not cloned I got the message "File Error: data may have been lost" when opening the file using excel. So my patch (which was simply adding a line in the clone() method to copy the data_value contents) sorted this out. Thanks for applying the patch, much appreciated. Niall Thanks for the explanation... but "empty cell" as a formula result, can you give an example... will help me cook up a testcase for later! |