diff options
author | Alain Béarez <abearez@apache.org> | 2018-10-05 14:36:18 +0000 |
---|---|---|
committer | Alain Béarez <abearez@apache.org> | 2018-10-05 14:36:18 +0000 |
commit | cffa31ed62836e89e3cc392190850fc6cfb71015 (patch) | |
tree | 65b3b57e50b709e6ae22a4875c9a7644b72e27be /src/ooxml/java/org/apache/poi | |
parent | f446df6f6647e765970e5074b8429856cf5cbffe (diff) | |
download | poi-cffa31ed62836e89e3cc392190850fc6cfb71015.tar.gz poi-cffa31ed62836e89e3cc392190850fc6cfb71015.zip |
example from StackOverflow question 47065690
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1842925 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi')
4 files changed, 28 insertions, 14 deletions
diff --git a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java index bde26ffb7e..b0a1e1031b 100644 --- a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java +++ b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java @@ -82,6 +82,19 @@ public class XDDFDateAxis extends XDDFChartAxis { return new XDDFShapeProperties(properties); } + /** + * @since 4.0.1 + */ + @Override + public void setTitle(String text) { + if (!ctDateAx.isSetTitle()) { + ctDateAx.addNewTitle(); + } + XDDFTitle title = new XDDFTitle(null, ctDateAx.getTitle()); + title.setOverlay(false); + title.setText(text); + } + @Override public boolean isSetMinorUnit() { return ctDateAx.isSetMinorUnit(); diff --git a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSeriesAxis.java b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSeriesAxis.java index 37ec0ddab3..5e555335b0 100644 --- a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSeriesAxis.java +++ b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSeriesAxis.java @@ -79,6 +79,19 @@ public class XDDFSeriesAxis extends XDDFChartAxis { return new XDDFShapeProperties(properties); } + /** + * @since 4.0.1 + */ + @Override + public void setTitle(String text) { + if (!ctSerAx.isSetTitle()) { + ctSerAx.addNewTitle(); + } + XDDFTitle title = new XDDFTitle(null, ctSerAx.getTitle()); + title.setOverlay(false); + title.setText(text); + } + @Override public boolean isSetMinorUnit() { return false; diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java index d2ce338787..8e6612f875 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java @@ -69,7 +69,7 @@ public final class XSLFChart extends XDDFChart { return XSLFFactory.getInstance(); } - public XSLFTextShape getTitle() { + public XSLFTextShape getTitleShape() { if (!chart.isSetTitle()) { chart.addNewTitle(); } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java index dc1ef9f2eb..d7971839f5 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java @@ -262,19 +262,6 @@ public final class XSSFChart extends XDDFChart implements Chart, ChartAxisFactor /** * Returns the title static text, or null if none is set. Note that a title - * formula may be set instead. - * - * @return static title text, if set - * @deprecated POI 3.16, use {@link #getTitleText()} instead. - */ - @Deprecated - @Removal(version = "4.0") - public XSSFRichTextString getTitle() { - return getTitleText(); - } - - /** - * Returns the title static text, or null if none is set. Note that a title * formula may be set instead. Empty text result is for backward * compatibility, and could mean the title text is empty or there is a * formula instead. Check for a formula first, falling back on text for @@ -313,6 +300,7 @@ public final class XSSFChart extends XDDFChart implements Chart, ChartAxisFactor * @param newTitle * to use */ + @Override public void setTitleText(String newTitle) { CTTitle ctTitle; if (chart.isSetTitle()) { |