From f40bec804dfb2c3bcac52239a4c55a63fd447cd0 Mon Sep 17 00:00:00 2001 From: Greg Woolsey Date: Tue, 14 Feb 2017 16:45:47 +0000 Subject: [PATCH] Expose another common property, strikeout. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782987 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ss/usermodel/FontFormatting.java | 6 ++++++ .../poi/xssf/usermodel/XSSFFontFormatting.java | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/java/org/apache/poi/ss/usermodel/FontFormatting.java b/src/java/org/apache/poi/ss/usermodel/FontFormatting.java index fe65f7eaea..79c5e4f845 100644 --- a/src/java/org/apache/poi/ss/usermodel/FontFormatting.java +++ b/src/java/org/apache/poi/ss/usermodel/FontFormatting.java @@ -136,6 +136,12 @@ public interface FontFormatting { */ boolean isItalic(); + + /** + * @return true if font strikeout is on + */ + boolean isStruckout(); + /** * set font style options. * diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java index f3b8fd41d3..a09ae77b7b 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java @@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.*; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTUnderlineProperty; import org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnderlineValues; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTVerticalAlignFontProperty; @@ -70,6 +71,18 @@ public class XSSFFontFormatting implements FontFormatting { } } + /** + * XMLBeans and the XSD make this look like it can have multiple values, but it is maxOccurrs=1. + * Use get*Array(), it is much faster than get*List(). + * + * @see org.apache.poi.ss.usermodel.FontFormatting#isStruckout() + */ + @Override + public boolean isStruckout() { + for (CTBooleanProperty bProp : _font.getStrikeArray()) if (bProp.getVal()) return true; + return false; + } + /** * @return font color index */ -- 2.39.5