[Libreoffice] [REVIEW] fix for fdo#37319: don't write invalid references to odf files

Kohei Yoshida kohei.yoshida at gmail.com
Tue Aug 9 22:30:06 PDT 2011


On Tue, 2011-08-09 at 22:56 +0200, Markus Mohrhard wrote:

>         
>         Given all this, I would feel a little more comfortable nailing
>         this on
>         master the right way, and *then* see if the change is safe
>         enough to be
>         backported to the 3.4 branch.
> 
> No problem with this. I'll push it to master with some other clean-up
> soon.

Sorry, I wasn't clear.

I meant to say that it's wrong to replace the whole formula expression
with #REF! when only one of the references is invalid.  And that's what
Eike was questioning too.

I'll give you an example.  Create a new document, and define a named
range such as

MyTest : $Sheet1.$A$1+$Sheet2.$A$1

Enter in A2

=MyTest

and you'll get 0 as the result of the calculation.

Now, delete Sheet2.  You'll get error in A2, but when you check the
definition of MyTest, you'll see

$Sheet1.$A$1+$#REF!.$A$2

When you save this document at this point, what gets saved is

table:expression="[$Sheet1.$A$1]+[$#REF!.$A$2]"

The bug reported in fdo#37391 says that as of ODF 1.2 you must write

table:expression="[$Sheet1.$A$1]+[#REF!]"

when one of sheet, column and row gets invalidated.

Since this expression is generated directly from ScCompiler, it's likely
affecting other areas where the formula expressions are generated from
ScCompiler on export.  And the right fix probably needs to be made
inside the formula compiler code too.

Regards,

Kohei



More information about the LibreOffice mailing list