After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 790756 - Cell comments are gone when open exported file in MS Excel
Cell comments are gone when open exported file in MS Excel
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
1.12.x
Other Linux
: Normal major
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2017-11-23 11:47 UTC by slimer
Modified: 2017-11-30 07:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sample initial Excel file with a comment (30.00 KB, application/vnd.ms-excel)
2017-11-23 11:49 UTC, slimer
  Details
Patch for test/ooxml/sml.xsd [not under version control] (1.36 KB, patch)
2017-11-27 00:22 UTC, Morten Welinder
none Details | Review
Scenario 1: ODS file with a problem (5.81 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-11-28 08:22 UTC, slimer
  Details
Scenario 2: ODS file with all comments visible (5.79 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-11-28 08:24 UTC, slimer
  Details

Description slimer 2017-11-23 11:47:50 UTC
Report describes problem with cell comments when working with MS Excel file in both, Gnumeric and MS Excel. Steps to recreate:

1. Create an *.xls file (Excel 97 workbook type) in MS Excel with some comments - example attached.
2. Open file in Gnumeric, and add another comment, second one. Save the file.
3. Open modified file in MS Excel - there is a warning that file structure is wrong, and some data lost. All comments are gone.

Played also with other formats:
a) when import to *.xlsx, result mostly the same - all comments are gone, and you cannot work with comments anymore (add comment button disabled)
b) when import to *.ods, new comments made in Gnumeric are visible ok, old comments made in Excel initially are actually present, but with zero length (i.e. the text in the comments from initial file is lost anyway).

Using Gnumeric 1.12.32 on Lubuntu 17.10
Comment 1 slimer 2017-11-23 11:49:38 UTC
Created attachment 364264 [details]
sample initial Excel file with a comment
Comment 2 Jean Bréfort 2017-11-24 07:13:00 UTC
The comments are visible both in Gnumeric and Calc. I have no Excel at hand to test.
Comment 3 slimer 2017-11-24 09:53:29 UTC
Yes, in Calc they are ok, but not in Excel.
If resaved by Calc, after Gnumeric, then ok in Excel also, but if saved in Gnumeric - there is a problem. So probably something with the file format, not the data itself.
Comment 4 slimer 2017-11-24 10:28:02 UTC
Checked today another format - Excel 5.0/95 (i.e. converted original xls file in Gnumeric to Excel 5.0). And I can see the comments (although the font is funny).
With Excel 97/2003 format I've got "File error: data may have been lost."
Comment 5 Morten Welinder 2017-11-25 00:02:14 UTC
I can confirm that the saved xlsx file has comments that can be seen
by Gnumeric, but not by Excel.

That shouldn't be too hard to fix.

Re xls, that format is basically on life support.  We might fix this if it
is easy, but no major work will be done.
Comment 6 Morten Welinder 2017-11-25 00:42:57 UTC
For xlsx, it looks like we do not save a drawing.  Both Excel and LO do.
There isn't much point in that drawing, except that it looks like Excel
wants it to be there.
Comment 7 Morten Welinder 2017-11-26 20:06:12 UTC
Fixed for xlsx.

slimer: can you elaborate what you see wrong for ods?
Comment 8 Morten Welinder 2017-11-26 21:00:09 UTC
We need this patch to the grammar.


welinder@dicentra:~/gnome-src/gnumeric/test> diff -u ooxml-schema/sml.xsd{~,} 
--- ooxml-schema/sml.xsd~	2015-02-10 08:23:52.456077000 -0500
+++ ooxml-schema/sml.xsd	2017-11-26 15:58:53.172949000 -0500
@@ -11,6 +11,17 @@
     schemaLocation="shared-commonSimpleTypes.xsd"/>
   <xsd:import namespace="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
     schemaLocation="dml-spreadsheetDrawing.xsd"/>
+
+  <!-- MW: This import and this complexType added 20171126 -->
+  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
+           schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+  <xsd:complexType name="CT_Text">
+    <xsd:simpleContent>
+      <xsd:extension base="s:ST_String">
+        <xsd:attribute ref="xml:space" use="optional"/>
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
   <xsd:complexType name="CT_AutoFilter">
     <xsd:sequence>
       <xsd:element name="filterColumn" minOccurs="0" maxOccurs="unbounded" type="CT_FilterColumn"/>
@@ -1808,7 +1819,8 @@
   <xsd:complexType name="CT_RElt">
     <xsd:sequence>
       <xsd:element name="rPr" type="CT_RPrElt" minOccurs="0" maxOccurs="1"/>
-      <xsd:element name="t" type="s:ST_Xstring" minOccurs="1" maxOccurs="1"/>
+      <!-- MW: changed type from s:ST_String to CT_Text on 20171126 -->
+      <xsd:element name="t" type="CT_Text" minOccurs="1" maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="CT_RPrElt">
Comment 9 Morten Welinder 2017-11-27 00:22:06 UTC
Created attachment 364469 [details] [review]
Patch for test/ooxml/sml.xsd [not under version control]

Same patch, as attachment.  The file to patch uses DOS line endings, so the
patch needs to use that too.
Comment 10 slimer 2017-11-27 08:55:07 UTC
Hmm... For *.ods cannot currently recreate. So observed behavior was like that:
1. create *.xls file with a comment in MS Excel
2. open in Gnumeric, add one more comment, save as *.ods
3. open in MS Excel - 1st comment is present, but empty (length is zero, text is lost). 2nd comment is ok.

Now after the same steps I can see both comments in Excel ok, but if I add a third comment in Excel, then back in Gnumeric there is a parsing error while open the file. Need to retest I believe, but will take some time, I have win/lin PCs in different locations.

Perhaps the issue showed up because I played with Author field in Gnumeric at the first time.
Comment 11 slimer 2017-11-28 08:22:19 UTC
Created attachment 364545 [details]
Scenario 1: ODS file with a problem
Comment 12 slimer 2017-11-28 08:24:15 UTC
Created attachment 364546 [details]
Scenario 2: ODS file with all comments visible
Comment 13 slimer 2017-11-28 08:34:37 UTC
I confirm, problem with *.ods persists when transferring files from Gnumeric to Excel.

Scenario 1:
1. create *.xls file with a comment in MS Excel
2. open in Gnumeric, add one more comment in another cell, save as *.ods
3. open in MS Excel - 1st comment is present, but empty (length is zero, text is lost). 2nd comment is ok.

Scenario 2:
1. create *.xls file with a comment in MS Excel
2. open in Gnumeric, add one more comment in another cell
3. modify original Excel comment, save as *.ods
4. open in MS Excel - all comments are ok.

Attached sample ods for both scenarios.
Comment 14 Morten Welinder 2017-11-28 12:36:53 UTC
Hmm...  That may be a Gnumeric problem or an Excel problem.

Andreas?
Comment 15 Andreas J. Guelzow 2017-11-29 03:32:13 UTC
This looks like an Excel problem:

In Scenario 1 the original Excel comment is:
<office:annotation>
              <dc:creator>YKK</dc:creator>
<text:p><text:span text:style-name="NS-font-size9"><text:span text:style-name="NS-colour-000000">sample comment</text:span></text:span></text:p></office:annotation>

In Scenario 2 the now modified Excel comment has become:
<office:annotation>
              <dc:creator>Master</dc:creator>
<text:p><text:span text:style-name="NS-colour-000000">sample comment</text:span><text:line-break/>(modified)</text:p></office:annotation>

The only significant difference I can see is that the Scenario 1 comment has a text:span inside a text:span
Comment 16 slimer 2017-11-29 09:57:12 UTC
I confirm, if I delete inner text:span in the Scenario 1 ods file, then comment becomes visible in Excel, so nested tags is a problem for Excel.
Comment 17 Morten Welinder 2017-11-29 15:39:54 UTC
So...

xlsx: FIXED
ods: NOTGNOME
xls: WONTFIX

?
Comment 18 slimer 2017-11-29 19:48:12 UTC
A pity about xls, but nothing to add from me I believe, if xlsx fixed now.

How to apply the xlsx patch? I did not find sml.xsd in my Lubuntu installation.
*feeling stupid*
Comment 19 Morten Welinder 2017-11-29 20:41:23 UTC
The patch for the code is here:

https://git.gnome.org/browse/gnumeric/commit/?id=f09cbffd1cc3d31230a087181d91f85ed587f3d2

The patch discussed in comment 9 is irrelevant unless you want to run the
test suite.  It patches a file from the official ooxml distribution.  We
do not distribute that -- it's big and there are likely licensing problems.
Comment 20 slimer 2017-11-29 20:50:58 UTC
I am afraid this is for more experienced users (these are sources, right?)

Will it be possible to get an update from Linux repository? I see Lubuntu still has 1.12.32 though...
Comment 21 Morten Welinder 2017-11-29 21:01:20 UTC
It'll make its way -- eventually.

Distributions generally do not pick up new versions of Gnumeric until
they roll a new release of the distributions.  In other words, it won't
be fast.
Comment 22 slimer 2017-11-29 21:10:24 UTC
Can Gnumeric download updates on its own?
Comment 23 Morten Welinder 2017-11-29 22:26:33 UTC
No.  In any case, we only distribute source code.
Comment 24 slimer 2017-11-30 07:54:39 UTC
Then we can call it a day I believe, at least for now :)