Bug 17582 - Formula Parser cannot parse formulas containing non-alphabetical characters
Summary: Formula Parser cannot parse formulas containing non-alphabetical characters
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC other
: P3 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-03 09:41 UTC by Jens Riis
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

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