aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-11-12 19:11:20 +0000
committerNick Burch <nick@apache.org>2014-11-12 19:11:20 +0000
commit7b6f10e70574f359e6f3860a87e1aac383b14be6 (patch)
tree3afd6e6cd3c1a60592c363de923f77a2acd2879b
parentd43ba17fe97c37d1f12583049638a95c9da26463 (diff)
downloadpoi-7b6f10e70574f359e6f3860a87e1aac383b14be6.tar.gz
poi-7b6f10e70574f359e6f3860a87e1aac383b14be6.zip
Add boolean getters/setters for bold to font, matching italic and underline, plus matching xssf
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1638954 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFFont.java21
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Font.java4
2 files changed, 21 insertions, 4 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
index 3d13e97587..73b402facd 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
@@ -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.
diff --git a/src/java/org/apache/poi/ss/usermodel/Font.java b/src/java/org/apache/poi/ss/usermodel/Font.java
index ee0d8add8b..4ddf474e43 100644
--- a/src/java/org/apache/poi/ss/usermodel/Font.java
+++ b/src/java/org/apache/poi/ss/usermodel/Font.java
@@ -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