GNOME Bugzilla – Bug 650640
Unable to parse '[#REF!]' on ODF import
Last modified: 2011-05-20 17:50:37 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!.
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.
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?
[#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.
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.
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.