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 650640 - Unable to parse '[#REF!]' on ODF import
Unable to parse '[#REF!]' on ODF import
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export OOo / OASIS
git master
Other Linux
: Normal normal
: ---
Assigned To: Andreas J. Guelzow
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2011-05-20 04:37 UTC by Andreas J. Guelzow
Modified: 2011-05-20 17:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sample file (9.53 KB, application/vnd.oasis.opendocument.spreadsheet)
2011-05-20 04:37 UTC, Andreas J. Guelzow
  Details
proposed patch (6.39 KB, patch)
2011-05-20 06:25 UTC, Andreas J. Guelzow
none Details | Review

Description Andreas J. Guelzow 2011-05-20 04:37:55 UTC
Created attachment 188201 [details]
sample file

Importing the attached sample file yields:

General ODF error
Unable to parse '[#REF!]' ('Invalid expression')

According to ODF v1.2 part II 5.8  [#REF!] is a valid expression that we should translate into #REF!.
Comment 1 Andreas J. Guelzow 2011-05-20 06:25:02 UTC
Created attachment 188204 [details] [review]
proposed patch

This patch would fix this bug and bug # 650639. This bug involves a small change to parser.y. It also handles these #REF! in all other situations where we parse references while importing an ODF file.
Comment 2 Morten Welinder 2011-05-20 13:22:44 UTC
That burns my eyes!

I don't think we need to put this into convs->input.range_ref -- it looks
to me more like a specialized constant.  Is it valid for other errors or
just this one?
Comment 3 Andreas J. Guelzow 2011-05-20 15:56:54 UTC
[#REF!] is only valid for this specific error (reference error).

The patch also handles the stuff from bug #650639, i.e. [$#REF!.$A$1] and friends.

Basically it allows convs->input.range_ref to return a flag (ref->a.sheet == GINT_TO_POINTER(-1)) to indicate that an invalid reference was parsed which becomes #REF!.

Inside the specific convs->input.range_ref we can handle the format specific stuff, in the ODF case this includes these strange constructs such as [#REF!] and [$#REF!.$A$1].

The longest part of this patch consists of checking the flag in all the other case where we use the odf range parsing without going through the parser.
Comment 4 Andreas J. Guelzow 2011-05-20 16:18:34 UTC
This would also allows us to parse stuff such as [$Sheet1.$#REF!$1] and
[$Sheet1.$A$#REF!] that isn't allowed in OpenFormula either but produced by localc.
Comment 5 Andreas J. Guelzow 2011-05-20 17:50:37 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.