Bug 60971 - XSSFChart getTitle(), setTitle(String) only handle static text, not expressions
Summary: XSSFChart getTitle(), setTitle(String) only handle static text, not expressions
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.16-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-11 18:05 UTC by Greg Woolsey
Modified: 2017-04-11 20:37 UTC (History)
0 users



Attachments

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