]> source.dussan.org Git - poi.git/commitdiff
[bug-65464] fix issue where shared formulas can be corrupted. Thanks to Nico Seegert
authorPJ Fanning <fanningpj@apache.org>
Mon, 2 Aug 2021 17:22:13 +0000 (17:22 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 2 Aug 2021 17:22:13 +0000 (17:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891962 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

index a631b5f22b43dc55668ed92ff1ceb633b862e8bd..27ad23611efa758c2fa216dcb059b2e7988d0e6d 100644 (file)
@@ -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());