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

New commits:
commit d66ae92ade617b390c879ac99d9bbca8a7b6617f
Author: Kohei Yoshida <kohei.yosh...@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())
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to