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 725453 - Reading from xls introduces value formats
Reading from xls introduces value formats
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
unspecified
Other All
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2014-03-01 17:45 UTC by Morten Welinder
Modified: 2014-03-01 18:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2014-03-01 17:45:13 UTC
Excel doesn't have value formats, only cell formats, so reading xls files
shouldn't come up with value formats, except perhaps to emulate something
weird I cannot think of right now.

1. New Gnumeric
2. A1=2
3. Format A1 as 0.00
4. Save as x.gnumeric
5. Save as x.xls
6. ssdiff --xml x.gnumeric x.xls

      <ssdiff:Cell Row="2" Col="0" OldValueType="40" Old="2" NewValueType="40" NewValueFormat="0.00" New="2"/>

The code responsible for this is a bit old:
    commit 167c36d3c506a091ea304e693a26ff7810914866
    Author: Jody Goldberg <jody@gnome.org>
    Date:   Mon Feb 4 03:20:04 2002 +0000
although it has been moved a good deal back and forth, left and right,
gotten duplicated, and gotten de-duplicated since then.
Comment 1 Morten Welinder 2014-03-01 17:56:01 UTC
I think I can see the reason why this was done:

An xls producer could use the format present in the value record to
set the format without having a style record that covers the cell.
We must, therefore, apply the format somehow.

Doing style changes cell-by-cell would chop up the quad-tree.  That
could be expensive.  Also, back in 2002 we did not have cover to
undo the chopping-up.

Note: booleans and empties cannot have value formats, so the mechanism
hasn't actually worked for those for ~6 years.

Note: the code also shies away from using this mechanism for "non-simple"
formats.  Those are formats with conditions in them.  I have no idea why.
Comment 2 Morten Welinder 2014-03-01 18:12:49 UTC
Patched in my tree.  Will commit later.