From 2522a3bc892d4565daf4a036a8e19d6673c2715c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20B=C3=A9arez?= Date: Mon, 2 Mar 2020 23:57:01 +0000 Subject: [PATCH] Remove chart title when given text is null git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1874704 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xddf/usermodel/chart/XDDFTitle.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java index e53415c1ce..fedd3f3d50 100644 --- a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java +++ b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java @@ -58,10 +58,16 @@ public class XDDFTitle { } public void setText(String text) { - if (!title.isSetLayout()) { - title.addNewLayout(); + if (text == null) { + if (title.isSetTx()) { + title.unsetTx(); + } + } else{ + if (!title.isSetLayout()) { + title.addNewLayout(); + } + getBody().setText(text); } - getBody().setText(text); } public void setOverlay(Boolean overlay) {