Bug 60971

Summary: XSSFChart getTitle(), setTitle(String) only handle static text, not expressions
Product: POI Reporter: Greg Woolsey <gwoolsey>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.16-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Greg Woolsey 2017-04-11 18:05:45 UTC
OOXML stores static text differently than expression strings.  The current code only works for static text chart titles.

POI needs some additional logic and methods in XSSFChart:

1) deprecate the existing methods
2) document they only apply to static text titles
3) point them to renamed versions:
     getTitleText()
     setTitleText(String)

4) add new methods to handle expressions:
     getTitleFormula()
     setTitleFormula(String)

I'm proposing "formula" method names since that's what is used elsewhere, such as data validations.

Callers would then need to use their current formula evaluation context to evaluate the chart title expression/formula.
Comment 1 Greg Woolsey 2017-04-11 20:37:56 UTC
Implemented in r1791025.

Note that the previous getTitle() returned an empty RichTextString when there was a formula based title defined.  That behavior is retained for compatibility.

The JavaDoc now indicates consumers should check for a formula string first, as that is  null if a static text title is defined or no title is defined.