]> source.dussan.org Git - poi.git/commitdiff
Remove chart title when given text is null
authorAlain Béarez <abearez@apache.org>
Mon, 2 Mar 2020 23:57:01 +0000 (23:57 +0000)
committerAlain Béarez <abearez@apache.org>
Mon, 2 Mar 2020 23:57:01 +0000 (23:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1874704 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java

index e53415c1ce57572818cf271c32c6ab21c01240a4..fedd3f3d507fa83ae0ff44db9ca68c4e4823a192 100644 (file)
@@ -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) {