[gnumeric] xls: fix import of long string results.



commit 177b8fad2754c0740be5ed70ba7985aa14d61e93
Author: Morten Welinder <terra gnome org>
Date:   Fri Feb 21 16:47:51 2014 -0500

    xls: fix import of long string results.

 NEWS                          |    1 +
 plugins/excel/ChangeLog       |    6 +++++-
 plugins/excel/ms-biff.c       |    3 +++
 plugins/excel/ms-excel-read.c |    5 +++++
 4 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 7a8762c..cfd2ae2 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ Morten:
        * Fix BIFF8 export of diagonal borders.
        * Export headers and footers to xlsx.  [Part of #724516]
        * Fix xls export of long strings in formulas.
+       * Fix xls import of cells with long string results.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.11
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index e6ba7ba..c66394c 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,7 +1,11 @@
 2014-02-21  Morten Welinder  <terra gnome org>
 
+       * ms-excel-read.c (excel_read_FORMULA): Try to handle missing
+       expression length.
+
        * ms-biff.c (ms_biff_query_next): Handle CONTINUE record for
-       BIFF_FORMULA_v0 too.
+       BIFF_FORMULA_v0, BIFF_FORMULA_v2, BIFF_STRING_v0, adn
+       BIFF_STRING_v2 too.
 
        * ms-excel-write.c (excel_write_string): Improve handling of
        string overflow.
diff --git a/plugins/excel/ms-biff.c b/plugins/excel/ms-biff.c
index eda7b90..7f60269 100644
--- a/plugins/excel/ms-biff.c
+++ b/plugins/excel/ms-biff.c
@@ -509,6 +509,9 @@ ms_biff_query_next (BiffQuery *q)
        case BIFF_LABEL_v0:
        case BIFF_LABEL_v2:
        case BIFF_FORMULA_v0:
+       case BIFF_FORMULA_v2:
+       case BIFF_STRING_v0:
+       case BIFF_STRING_v2:
                auto_continue = TRUE;
                break;
        case BIFF_CONTINUE:
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 9d94e0c..ba79b0d 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -2923,6 +2923,11 @@ excel_read_FORMULA (BiffQuery *q, ExcelReadSheet *esheet)
                XL_CHECK_CONDITION (q->length >= 22);
                expr_length = GSF_LE_GET_GUINT16 (q->data + 20);
                offset = 22;
+               if (expr_length == 0) {
+                       /* Now what?  This happens when we have a continuation
+                          record for a formula.  */
+                       expr_length = q->length - offset;
+               }
        } else if (esheet_ver (esheet) >= MS_BIFF_V3) {
                XL_CHECK_CONDITION (q->length >= 18);
                expr_length = GSF_LE_GET_GUINT16 (q->data + 16);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]