Bug 49720

Summary: getRefersToFormula() returns a formula with '$' characters removed, for column references
Product: POI Reporter: Tony Harvey <TonyHarvey>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 3.6-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

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.