Bug 8624

Summary: [PATCH] formulas:- handle floats and misc cleanup
Product: POI Reporter: Avik Sengupta <avik>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: Patch file
New File added

Description Avik Sengupta 2002-04-29 14:58:32 UTC
 
Comment 1 Avik Sengupta 2002-04-29 14:59:37 UTC
Created attachment 1733 [details]
Patch file
Comment 2 Avik Sengupta 2002-04-29 15:00:49 UTC
Created attachment 1734 [details]
New File added
Comment 3 Andy Oliver 2002-04-29 16:54:31 UTC
I will commit tonight.
Comment 4 Avik Sengupta 2002-04-29 17:46:54 UTC
Add the following to createPtg(byte [] data, int offset) in Ptg.java . Sorry, 
couldnt figure how to create an incremental patch, full patch takes too much 
time. 
------------------------------------------------------------------------------
 case NumberPtg.sid :
                retval = new NumberPtg(data, offset);
                break;

------------------------------------------------------------------------------
Also, add the following to testcases/../../usermodel/TestFormulas.java .. the 
test writes correctly, still working on the read, which works, except for the 
fact that one needs to take care of the fact that anything written as 1.10 will 
come back as 1.1
-------------------------------------------------------------------------------
public void testFloat()
    throws Exception {
        String operator = "+";
        short            rownum = 0;
        File file = File.createTempFile("testFormulaFloat",".xls");
        FileOutputStream out    = new FileOutputStream(file);
        HSSFWorkbook     wb     = new HSSFWorkbook();
        HSSFSheet        s      = wb.createSheet();
        HSSFRow          r      = null;
        HSSFCell         c      = null;
        
            for (short x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
            r = s.createRow((short) x);

            for (short y = 1; y < 256 && y > 0; y++) {

                c = r.createCell((short) y);
                c.setCellFormula("" + (100*x)+"."+y + operator + (10000*y)
+"."+x);
                
            }
        }
        
        wb.write(out);
        out.close();
        assertTrue("file exists",file.exists());
              
        
    }

-------------------------------------------------------------------------------
Comment 5 Andy Oliver 2002-04-30 03:59:49 UTC
applied, please cross check (Also added some new code for functionions)