aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src/main
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-10-09 12:26:21 +0000
committerPJ Fanning <fanningpj@apache.org>2021-10-09 12:26:21 +0000
commit08a1f9af227ad39a01844d4d9d0fc32947f4511d (patch)
treef6311855e9281af5660ca30b454d2173f6b58b3d /poi-ooxml/src/main
parent798f8c1db3a46bfbc9c8d1829a9720b0823a6f90 (diff)
downloadpoi-08a1f9af227ad39a01844d4d9d0fc32947f4511d.tar.gz
poi-08a1f9af227ad39a01844d4d9d0fc32947f4511d.zip
[bug-65268] issue reading shared formulas
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894064 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src/main')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java22
1 files changed, 9 insertions, 13 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
index b383413e70..e953378dee 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
@@ -4666,25 +4666,21 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
XSSFCell nextCell = row.getCell(j);
if(nextCell != null && nextCell != cell && nextCell.getCellType() == CellType.FORMULA) {
CTCellFormula nextF = nextCell.getCTCell().getF();
- nextF.setStringValue(nextCell.getCellFormula(evalWb));
- //https://bz.apache.org/bugzilla/show_bug.cgi?id=65464
- nextF.setT(STCellFormulaType.SHARED);
- if (!nextF.isSetSi()) {
- nextF.setSi(f.getSi());
+ if (nextF.getT() == STCellFormulaType.SHARED && nextF.getSi() == f.getSi()) {
+ nextF.setStringValue(nextCell.getCellFormula(evalWb));
+ CellRangeAddress nextRef = new CellRangeAddress(
+ nextCell.getRowIndex(), ref.getLastRow(),
+ nextCell.getColumnIndex(), ref.getLastColumn());
+ nextF.setRef(nextRef.formatAsString());
+
+ sharedFormulas.put(Math.toIntExact(nextF.getSi()), nextF);
+ break DONE;
}
- CellRangeAddress nextRef = new CellRangeAddress(
- nextCell.getRowIndex(), ref.getLastRow(),
- nextCell.getColumnIndex(), ref.getLastColumn());
- nextF.setRef(nextRef.formatAsString());
-
- sharedFormulas.put(Math.toIntExact(nextF.getSi()), nextF);
- break DONE;
}
}
}
}
}
-
}
}