aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-08-02 17:22:13 +0000
committerPJ Fanning <fanningpj@apache.org>2021-08-02 17:22:13 +0000
commiteecb44281e5106d690d7dada9183910369419980 (patch)
tree4fc1864fd95e17ab114f8072c231aef5dbddc65f
parentcceb9102549f645c8622371804e659de40fa69f2 (diff)
downloadpoi-eecb44281e5106d690d7dada9183910369419980.tar.gz
poi-eecb44281e5106d690d7dada9183910369419980.zip
[bug-65464] fix issue where shared formulas can be corrupted. Thanks to Nico Seegert
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891962 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java6
1 files changed, 5 insertions, 1 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 a631b5f22b..27ad23611e 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
@@ -4625,7 +4625,11 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
if(nextCell != null && nextCell != cell && nextCell.getCellType() == CellType.FORMULA) {
CTCellFormula nextF = nextCell.getCTCell().getF();
nextF.setStringValue(nextCell.getCellFormula(evalWb));
- nextF.setT(STCellFormulaType.SHARED); //https://bz.apache.org/bugzilla/show_bug.cgi?id=65464
+ //https://bz.apache.org/bugzilla/show_bug.cgi?id=65464
+ nextF.setT(STCellFormulaType.SHARED);
+ if (!nextF.isSetSi()) {
+ nextF.setSi(f.getSi());
+ }
CellRangeAddress nextRef = new CellRangeAddress(
nextCell.getRowIndex(), ref.getLastRow(),
nextCell.getColumnIndex(), ref.getLastColumn());