aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-02-01 10:36:34 +0000
committerPJ Fanning <fanningpj@apache.org>2022-02-01 10:36:34 +0000
commit20dfe361ca2933199deb65a6570b40740f86125b (patch)
tree710bc3c82c9bfef2e2a0409bda8858f88b34538c /poi-ooxml
parent9f4b00861305567cd9cfec73b713b9e770df30cd (diff)
downloadpoi-20dfe361ca2933199deb65a6570b40740f86125b.tar.gz
poi-20dfe361ca2933199deb65a6570b40740f86125b.zip
add excel Workbook.usesR1C1CellReferences()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897649 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java6
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java14
2 files changed, 19 insertions, 1 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
index 189787f96b..584a1f3f23 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
@@ -1350,9 +1350,13 @@ public class SXSSFWorkbook implements Workbook {
return _wb.addOlePackage(oleData, label, fileName, command);
}
-
@Override
public EvaluationWorkbook createEvaluationWorkbook() {
return SXSSFEvaluationWorkbook.create(this);
}
+
+ @Override
+ public Boolean usesR1C1CellReferences() {
+ return getXSSFWorkbook().usesR1C1CellReferences();
+ }
}
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index 7988e4e6e0..47e19e2956 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -20,6 +20,7 @@ package org.apache.poi.xssf.usermodel;
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
import static org.apache.poi.xssf.usermodel.helpers.XSSFPasswordHelper.setPassword;
import static org.apache.poi.xssf.usermodel.helpers.XSSFPasswordHelper.validatePassword;
+import static org.openxmlformats.schemas.spreadsheetml.x2006.main.STRefMode.*;
import java.io.File;
import java.io.IOException;
@@ -1566,6 +1567,19 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
setPrintArea(sheetIndex, reference);
}
+ @Override
+ public Boolean usesR1C1CellReferences() {
+ final CTCalcPr calcPr = getCTWorkbook().getCalcPr();
+ if (calcPr == null) {
+ return null;
+ } else if (calcPr.getRefMode() == R_1_C_1) {
+ return Boolean.TRUE;
+ } else if (calcPr.getRefMode() == A_1) {
+ return Boolean.FALSE;
+ }
+ return null;
+ }
+
private static String getReferencePrintArea(String sheetName, int startC, int endC, int startR, int endR) {
//windows excel example: Sheet1!$C$3:$E$4
CellReference colRef = new CellReference(sheetName, startR, startC, true, true);