[gnumeric] xls: roundtrip the binary \001Ole member is present.



commit 0e4214703f2f7cc2cdc49cd2df11a52ca06462a3
Author: Morten Welinder <terra gnome org>
Date:   Wed Feb 26 10:01:53 2014 -0500

    xls: roundtrip the binary \001Ole member is present.

 plugins/excel/ChangeLog |    1 +
 plugins/excel/boot.c    |   16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 1efa118..703dc8d 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -2,6 +2,7 @@
 
        * boot.c (excel_save): Make sure to save macros in the
        _VBA_PROJECT_CUR directory that we loaded them from.
+       (excel_save): Restore \001Ole member too.
 
 2014-02-25  Morten Welinder  <terra gnome org>
 
diff --git a/plugins/excel/boot.c b/plugins/excel/boot.c
index 4188f2e..5bdf292 100644
--- a/plugins/excel/boot.c
+++ b/plugins/excel/boot.c
@@ -220,8 +220,9 @@ excel_enc_file_open (GOFileOpener const *fo, char const *enc, GOIOContext *conte
                        }
 
                        /* LOOKS BROKEN */
-                       g_object_set_data_full (G_OBJECT (wb), "MS_EXCEL_COMPOBJ",
+                       g_object_set_data_full (G_OBJECT (wb), "MS_EXCEL_COMPOBJ_STREAM",
                                gsf_structured_blob_read (stream), g_object_unref);
+
                        g_object_set_data_full (G_OBJECT (wb), "MS_EXCEL_MACROS",
                                gsf_structured_blob_read (macros), g_object_unref);
                        g_object_unref (macros);
@@ -229,6 +230,13 @@ excel_enc_file_open (GOFileOpener const *fo, char const *enc, GOIOContext *conte
                g_object_unref (stream);
        }
 
+       stream = gsf_infile_child_by_name (ole, "\01Ole");
+       if (stream) {
+               g_object_set_data_full (G_OBJECT (wb), "MS_EXCEL_OLE_STREAM",
+                                       gsf_structured_blob_read (stream), g_object_unref);
+               g_object_unref (stream);
+       }
+
        g_object_unref (ole);
 
        /* simple guess of format based on stream names */
@@ -298,7 +306,11 @@ excel_save (GOIOContext *context, WorkbookView const *wbv, GsfOutput *output,
        }
 
        /* restore the macros we loaded */
-       blob = g_object_get_data (G_OBJECT (wb), "MS_EXCEL_COMPOBJ");
+       blob = g_object_get_data (G_OBJECT (wb), "MS_EXCEL_COMPOBJ_STREAM");
+       if (blob != NULL)
+               gsf_structured_blob_write (blob, outfile);
+
+       blob = g_object_get_data (G_OBJECT (wb), "MS_EXCEL_OLE_STREAM");
        if (blob != NULL)
                gsf_structured_blob_write (blob, outfile);
 


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