http://issues.apache.org/bugzilla/show_bug.cgi?id=44495





--- Comment #1 from Josh Micich <[EMAIL PROTECTED]>  2008-02-27 11:39:30 ---
I am in the process of extending the formula parser to support a few more
things (operator precedence, error literals, named ranges, external functions,
etc).  As currently coded, POI assumes all identifiers in formulas should be
converted to uppercase.  In my opinion, this is NQR, because Excel is not
simply "case insensitive", but also "case aware".

Here is a test case which hopefully targets the problem you are describing:

    public void testParseNamedRangesCaseSensitivity() {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet();
        wb.setSheetName(0, "Sheet1");
        HSSFCell cell = sheet.createRow(0).createCell((short)0);

        HSSFName hssfName = wb.createName();
        hssfName.setNameName("myNamedCell"); // camelcase !

        cell.setCellFormula("mynamedcell");
        String actualFormula=cell.getCellFormula();
        assertEquals("myNamedCell", actualFormula); // not "MYNAMEDCELL", not
"mynamedcell"
   }

If you put a breakpoint in the no-arg constructor of NameRecord, you can see
why this is occurring.

NameRecord.<init>() line: 124   
NamePtg.<init>(String, Workbook) line: 58       <<<< problem in this method
FormulaParser.Ident() line: 336                 <<<< another problem here
FormulaParser.Factor() line: 522        
FormulaParser.Term() line: 660  
FormulaParser.Expression() line: 708    
FormulaParser.parse() line: 812 
HSSFCell.setCellFormula(String) line: 643       
TestFormulaParser.testParseNamedRangesCaseSensitivity() line: 3742      

I made a patch diff file that fixes _just_ this issue.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to