Bug 17582

Summary: Formula Parser cannot parse formulas containing non-alphabetical characters
Product: POI Reporter: Jens Riis <ext-jens.riis>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: other   

Description Jens Riis 2003-03-03 09:41:24 UTC
The formulaparser fails when text contains no alpha characters (e.g) giving the 
argument "(" & F3 & ")" throws an exception. The code in 
org.apache.poi.hssf.model.FormulaParser.StringLiteral() executes the method 
GetNameAsIs() which in turn calls isAlpha() that only allows for alphabetic 
characters which of course is to limited for a formula like the above.
Comment 1 Danny Mui 2003-03-04 17:26:43 UTC
Can you provide the snippet of code to duplicate this (ie a testcase)?

Can you also provide the Excel use for such a formula (for people that aren't
100% experts in Excel).

Thanks
Comment 2 Jens Riis 2003-03-05 06:54:33 UTC
Example

      String currencyCell = "F3";
      HSSFWorkbook wb = new HSSFWorkbook();

      HSSFSheet sheet = wb.createSheet(quote.getName());
      HSSFRow row = sheet.createRow((short) 0);
      HSSFCell cell = row.createCell((short) 0);
      cell.setCellFormula("\"TOTAL[\" & " + currencyCell + " & \"]\"");

In this case I had a request to create a spreadsheet, that in cell F3 would 
contain a currency (by the user typing it), and several other cells would use 
that value to display a heading e.g. typing USD in cell F3 would display "Total 
[USD]" in cell A1.(obviously the requirement of the square brackets could be 
relaxed).
Comment 3 Danny Mui 2003-03-17 04:51:46 UTC
Resolved in nightly build as of March 17, 2003

Thanks for the bug report!