diff options
author | Nick Burch <nick@apache.org> | 2016-02-15 14:58:16 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2016-02-15 14:58:16 +0000 |
commit | 8c203f136623bbf343972f581a22a18a4121693d (patch) | |
tree | 8a2cc44be1cc9a0130fb61b152cac04cd6a4185d /src/ooxml/java/org/apache/poi/xssf/usermodel/helpers | |
parent | 3b5586ea794a2f9c371bc516ae3368c75d1a49d3 (diff) | |
download | poi-8c203f136623bbf343972f581a22a18a4121693d.tar.gz poi-8c203f136623bbf343972f581a22a18a4121693d.zip |
Add details of the ignored errors where the HSSF spec provides a good description, and a bit more refactoring. #56892
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1730543 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xssf/usermodel/helpers')
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFIgnoredErrorHelper.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFIgnoredErrorHelper.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFIgnoredErrorHelper.java index 4911a3532d..d0dc0b7606 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFIgnoredErrorHelper.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFIgnoredErrorHelper.java @@ -17,8 +17,12 @@ package org.apache.poi.xssf.usermodel.helpers; -import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTIgnoredError; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + import org.apache.poi.ss.usermodel.IgnoredErrorType; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTIgnoredError; /** * XSSF-specific code for working with ignored errors @@ -82,4 +86,21 @@ public class XSSFIgnoredErrorHelper { throw new IllegalStateException(); } } + + public static void addIgnoredErrors(CTIgnoredError err, String ref, IgnoredErrorType... ignoredErrorTypes) { + err.setSqref(Arrays.asList(ref)); + for (IgnoredErrorType errType : ignoredErrorTypes) { + XSSFIgnoredErrorHelper.set(errType, err); + } + } + + public static Set<IgnoredErrorType> getErrorTypes(CTIgnoredError err) { + Set<IgnoredErrorType> result = new LinkedHashSet<IgnoredErrorType>(); + for (IgnoredErrorType errType : IgnoredErrorType.values()) { + if (XSSFIgnoredErrorHelper.isSet(errType, err)) { + result.add(errType); + } + } + return result; + } } |