aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml
diff options
context:
space:
mode:
Diffstat (limited to 'src/ooxml')
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java18
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFIgnoredErrorHelper.java23
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java1
3 files changed, 25 insertions, 17 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
index 40d765a1da..ee83e78c69 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
@@ -4133,7 +4133,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
Map<IgnoredErrorType, Set<CellRangeAddress>> result = new LinkedHashMap<IgnoredErrorType, Set<CellRangeAddress>>();
if (worksheet.isSetIgnoredErrors()) {
for (CTIgnoredError err : worksheet.getIgnoredErrors().getIgnoredErrorList()) {
- for (IgnoredErrorType errType : getErrorTypes(err)) {
+ for (IgnoredErrorType errType : XSSFIgnoredErrorHelper.getErrorTypes(err)) {
if (!result.containsKey(errType)) {
result.put(errType, new LinkedHashSet<CellRangeAddress>());
}
@@ -4149,20 +4149,6 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
private void addIgnoredErrors(String ref, IgnoredErrorType... ignoredErrorTypes) {
CTIgnoredErrors ctIgnoredErrors = worksheet.isSetIgnoredErrors() ? worksheet.getIgnoredErrors() : worksheet.addNewIgnoredErrors();
CTIgnoredError ctIgnoredError = ctIgnoredErrors.addNewIgnoredError();
- ctIgnoredError.setSqref(Arrays.asList(ref));
- for (IgnoredErrorType errType : ignoredErrorTypes) {
- XSSFIgnoredErrorHelper.set(errType, ctIgnoredError);
- }
+ XSSFIgnoredErrorHelper.addIgnoredErrors(ctIgnoredError, ref, ignoredErrorTypes);
}
-
- private 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;
- }
-
}
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;
+ }
}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
index 158cc75018..f5ad27c815 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
@@ -49,6 +49,7 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellCopyPolicy;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.FormulaError;
+import org.apache.poi.ss.usermodel.IgnoredErrorType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;