Bug 18114

Summary: Division By Zero yields (Data may be lost prompt in Excel)
Product: POI Reporter: Danny Mui <dmui>
Component: HSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: Excel File (Pre-poi)

Description Danny Mui 2003-03-18 17:00:00 UTC
When reading a file with a formula that divides by zero, an excel prompt of
"Warning:data may be lost" is presented to the user.
Comment 1 Danny Mui 2003-03-18 17:00:32 UTC
Created attachment 5411 [details]
Excel File (Pre-poi)
Comment 2 Danny Mui 2003-03-18 17:01:11 UTC
public class POITest {

	public static void main(String[] args) throws IOException {
		File file = new File("divbug.xls");
		InputStream input = new FileInputStream(file);
		HSSFWorkbook wb = new HSSFWorkbook(input);
		File outFile = new File("divbug-poi.xls");
		OutputStream output = new FileOutputStream(outFile);
Comment 3 Avik Sengupta 2003-03-18 19:31:52 UTC
Interesting, to say the least. I think the issue is in an ErrorPtg that poi does
not yet handle. It should be simple to add these to poi, since they wouldnt
affect the formula parser.. you just have to read them and spit them out
whenever necessary. The only issue is the tediousness of implementing all the
ErrorPtg classes. 
Comment 4 Danny Mui 2003-03-19 15:53:31 UTC
i was hoping it was simple (didnt look at it yet) but tedious ack.  you do what
you have to do..
Comment 5 Danny Mui 2003-03-29 20:05:37 UTC
Apparently our LittleEndian NaN support didn't create a suitable value when
fillingFields for a FormulaRecord with my Excel version (2000).

When we created a workbook from scratch with a div by zero formula, the value is
0 and not NaN.

The fix was to preserve Excel's NaN representation and serialize it out again
when using fillFields.