[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Sep 10 21:27:05 PDT 2013


 sc/source/filter/oox/formulabuffer.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d66ae92ade617b390c879ac99d9bbca8a7b6617f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Sep 11 00:25:27 2013 -0400

    Fix crashers on xlsx import, due to shared formula range being wrong.
    
    Shared formula range that Excel gives is incorrect about half the time.
    It's better to ignore that altogether.
    
    Change-Id: I2302c6dd1b5883e32305d4c511f942bf4cebca3a

diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 0651071..21e383f 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -166,7 +166,7 @@ void FormulaBuffer::applySharedFormulas( sal_Int32 nTab )
                     // shared formulas across multiple columns.
                     ScFormulaCellGroupRef xNewGroup(new ScFormulaCellGroup);
                     xNewGroup->mnStart = rRange.StartRow;
-                    xNewGroup->mnLength = rRange.EndRow - rRange.StartRow + 1;
+                    xNewGroup->mnLength = 1; // Length gets updated as we go.
                     xNewGroup->setCode(*pArray);
                     aGroups.set(nId, nCol, xNewGroup);
                 }
@@ -200,6 +200,9 @@ void FormulaBuffer::applySharedFormulas( sal_Int32 nTab )
                 continue;
             }
 
+            // Update the length of shared formula span as we go. The length
+            // that Excel gives is not always correct.
+            xGroup->mnLength = aPos.Row() - xGroup->mnStart + 1;
             pCell->StartListeningTo(&rDoc);
 
             if (it->maCellValue.isEmpty())


More information about the Libreoffice-commits mailing list