Bug 18114 - Division By Zero yields (Data may be lost prompt in Excel)
Summary: Division By Zero yields (Data may be lost prompt in Excel)
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-18 17:00 UTC by Danny Mui
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Excel File (Pre-poi) (13.50 KB, application/octet-stream)
2003-03-18 17:00 UTC, Danny Mui
Details

Note You need to log in before you can comment on or make changes to this bug.
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);
		input.close();
		
		File outFile = new File("divbug-poi.xls");
		outFile.createNewFile();
		OutputStream output = new FileOutputStream(outFile);
		wb.write(output);
		output.close();
		
	}
}
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.