Bug 49720 - getRefersToFormula() returns a formula with '$' characters removed, for column references
Summary: getRefersToFormula() returns a formula with '$' characters removed, for colum...
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.6-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2010-08-06 16:08 UTC by Tony Harvey
Modified: 2015-05-31 21:35 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Tony Harvey 2010-08-06 16:08:18 UTC
Excel creates named column references of the form 'SW'!$AL:$AL.
However when these are accessed using the Name's getRefersToFormula() method the string returned is missing the '$' characters, e.g. 'SW'!AL:AL

PS: I have an easy workaround for any one who cares:

  Name name = iwb2.getNameAt(n);
  String formula = name.getRefersToFormula();
  if (!formula.contains("$"))
    int pos = formula.indexOf('!');
    formula = formula.substring(0, pos+1) + '$'
            + formula.substring(pos+1);
    pos = formula.indexOf(':');
    formula = formula.substring(0, pos+1) + '$'
            + formula.substring(pos+1);
Comment 1 Nick Burch 2010-09-21 07:23:43 UTC
POI should be returning the formula as it is stored. It would seem that Excel is writing it using one set of relative/absolute settings, but displaying it using the other

Are you able to upload a simple file with one of these references in, for people to investigate further with? If so, please also include a note of what Excel shows as the reference
Comment 2 Dominik Stadler 2015-05-31 21:35:56 UTC
No update on the request for a sample document, thus resolving this as WONTFIX for now, there have been a large number of changes in the meantime, if this is still a problem for you please reopen this bug with more information, e.g. a sample document and some sample code that reproduces the problem, preferably as unit-test which allows us to reproduce the problem.