]> source.dussan.org Git - poi.git/commitdiff
Add method for setting bullet styles
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 31 Oct 2015 23:10:43 +0000 (23:10 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 31 Oct 2015 23:10:43 +0000 (23:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1711707 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/sl/usermodel/TextParagraph.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java

index b35d323e1a73b438b2c34b333540e40e721911e1..a0f67bd61b926f04489c313e4a8f6e169e448a8e 100644 (file)
@@ -332,6 +332,15 @@ public interface TextParagraph<
      * @return the bullet style of the paragraph, if {@code null} then no bullets are used \r
      */\r
     BulletStyle getBulletStyle();\r
+\r
+    /**\r
+     * Sets the bullet styles. If no styles are given, the bullets are omitted.\r
+     * Possible attributes are integer/double (bullet size), Color (bullet color),\r
+     * character (bullet character), string (bullet font), AutoNumberingScheme\r
+     *\r
+     * @param styles\r
+     */\r
+    void setBulletStyle(Object... styles);\r
     \r
     /**\r
      * @return the default size for a tab character within this paragraph in points, null if unset\r
index cc12a634267d8f6c3298e464c942e28678aa9632..31df98787a0d1a2640096b6a9b9d228059181f8b 100644 (file)
@@ -985,4 +985,26 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
 \r
         };\r
     }\r
+\r
+    @Override\r
+    public void setBulletStyle(Object... styles) {\r
+        if (styles.length == 0) {\r
+            setBullet(false);\r
+        } else {\r
+            setBullet(true);\r
+            for (Object ostyle : styles) {\r
+                if (ostyle instanceof Number) {\r
+                    setBulletFontSize(((Number)ostyle).doubleValue());\r
+                } else if (ostyle instanceof Color) {\r
+                    setBulletFontColor((Color)ostyle);\r
+                } else if (ostyle instanceof Character) {\r
+                    setBulletCharacter(ostyle.toString());\r
+                } else if (ostyle instanceof String) {\r
+                    setBulletFont((String)ostyle);\r
+                } else if (ostyle instanceof AutoNumberingScheme) {\r
+                    setBulletAutoNumber((AutoNumberingScheme)ostyle, 0);\r
+                }\r
+            }\r
+        }\r
+    }\r
 }\r