Bug 8624 - [PATCH] formulas:- handle floats and misc cleanup
Summary: [PATCH] formulas:- handle floats and misc cleanup
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: 2002-04-29 14:58 UTC by Avik Sengupta
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Patch file (7.25 KB, patch)
2002-04-29 14:59 UTC, Avik Sengupta
Details | Diff
New File added (3.80 KB, text/plain)
2002-04-29 15:00 UTC, Avik Sengupta
Details

Note You need to log in before you can comment on or make changes to this bug.
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)