]> source.dussan.org Git - poi.git/commitdiff
Add boolean getters/setters for bold to font, matching italic and underline, plus...
authorNick Burch <nick@apache.org>
Wed, 12 Nov 2014 19:11:20 +0000 (19:11 +0000)
committerNick Burch <nick@apache.org>
Wed, 12 Nov 2014 19:11:20 +0000 (19:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1638954 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
src/java/org/apache/poi/ss/usermodel/Font.java

index 3d13e97587b850d67557bef4850c754f03a6cf9c..73b402facd2787affb0ddca58dd76084d5e12700 100644 (file)
@@ -206,11 +206,21 @@ public final class HSSFFont implements Font {
      * @see #BOLDWEIGHT_NORMAL
      * @see #BOLDWEIGHT_BOLD
      */
-
     public void setBoldweight(short boldweight)
     {
         font.setBoldWeight(boldweight);
     }
+    
+    /**
+     * sets the font to be bold or not
+     */
+    public void setBold(boolean bold)
+    {
+        if (bold)
+            font.setBoldWeight(BOLDWEIGHT_BOLD);
+        else
+            font.setBoldWeight(BOLDWEIGHT_NORMAL);
+    }
 
     /**
      * get the boldness to use
@@ -218,11 +228,18 @@ public final class HSSFFont implements Font {
      * @see #BOLDWEIGHT_NORMAL
      * @see #BOLDWEIGHT_BOLD
      */
-
     public short getBoldweight()
     {
         return font.getBoldWeight();
     }
+    
+    /**
+     * get if the font is bold or not
+     */
+    public boolean getBold()
+    {
+        return getBoldweight() == BOLDWEIGHT_BOLD;
+    }
 
     /**
      * set normal,super or subscript.
index ee0d8add8b88a18f1a7207580e2dabfea84e2be9..4ddf474e43962a3aed869e86b948beae636a62e3 100644 (file)
@@ -277,8 +277,8 @@ public interface Font {
     public short getIndex();
 
     public void setBoldweight(short boldweight);
+    public void setBold(boolean bold);
 
     public short getBoldweight();
-
-
+    public boolean getBold();
 }
\ No newline at end of file