Bug 63570 - Export: Writer does not evaluate formulas when converting to pdf or printing by command line
Summary: Export: Writer does not evaluate formulas when converting to pdf or printing ...
Status: RESOLVED DUPLICATE of bug 121962
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
3.6.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 92181 98183 (view as bug list)
Depends on:
Blocks: Commandline
  Show dependency treegraph
 
Reported: 2013-04-15 19:55 UTC by Milos Sramek
Modified: 2018-12-15 14:09 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Files demonstrating the problem (196.40 KB, application/x-gzip)
2013-04-15 19:55 UTC, Milos Sramek
Details
PDF of original ODT with expanded rows to better show the error message. (66.17 KB, application/pdf)
2013-07-17 00:33 UTC, Owen Genat (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Sramek 2013-04-15 19:55:23 UTC
Created attachment 78015 [details]
Files demonstrating the problem

Hi,

Write does not evaluate formulas in odt files while converting to pdf or printing from command line.
Formulas are evaluated correctly when converting from docx and rtf files
Formulas are evaluated correctly when converting from odf by Apache OO 3.4

To reproduce:
Convert file tabulky2.LO40.odt to pdf by

libreoffice4.0 --headless --convert-to pdf tabulky2-LO40.odt

or print it by

libreoffice4.0 --headless --print-to-file xx.odt tabulky2-LO40.odt

Instead of the result an error message appears: "** Expression is faulty **" (in  the yellow field)

Try the same with the rtf and docx files - the result is correct

--
Milos
Comment 1 Owen Genat (retired) 2013-07-17 00:33:55 UTC
Created attachment 82514 [details]
PDF of original ODT with expanded rows to better show the error message.

This is just a confirmation of the problem with clarification. The problem only occurs for the ODT and not the DOCX or RTF (as the ODT contains formulas and the DOCX/RTF do not - they contain literal values). I can't confirm if AOO v3.4 converts the formulas in the ODT correctly, but if it does, then this may be a regression. In the ODT the initial 4-row Writer table includes these formulas in the last (red) row:

= sum<B2:B3>       # which displays "70"
= sum(<B4>)<C2:C3> # which displays "105"

The yellow table then references these two cells using the formulas:

= <Tabulka.B4>     # i.e., the "70" value above
= <Tabulka.C4>     # i.e., the "105" value above

I edited the original ODT by expanding the rows receiving the error in order to more clearly show the result. The attached PDF, generated from this edited ODT, clearly shows that the two cells in the red row result in "** Expression is faulty **", as do the two cells in the yellow row (which reference the two red cells). I have re-confirmed this by creating a new ODT containing only two simple tables: the first sums a cell containing "30" and a cell containing "40"; the second references the result of this sum formula. Resulting notation in ODT and output in the PDF are identical to the original files, thus I did not bother attaching them.

Tests conducted under GNU/Linux Crunchbang 11 running TDF/LO v4.0.4.2 (Build ID: 9e9821abd0ffdbc09cd8c52eaa574fa09eb08f2).
Comment 2 under_the_line 2014-07-25 07:00:49 UTC
Hi,

I'd like to push this bug report.
I ran into the same problem under windows and ubuntu.

Sum calculations endet up in "Faulty expression"-error.
If I calculate like "= <A1>+<A2><A3>" the result ist correct.

I also found out, that sum works if the table ist the very first element in the odt File.

Maybe, there is already a solution for this problem?

--
Chris
Comment 3 Owen Genat (retired) 2014-07-25 11:27:17 UTC
The problem of the formulas in the red row not totalling correctly (and not being referenced correctly in the yellow row) seems to be fixed in all these versions under GNU/Linux:

- v4.1.6.2 Build ID: 40ff705089295be5be0aae9b15123f687c05b0a
- v4.2.5.2 Build ID: 61cb170a04bb1f12e77c884eab9192be736ec5f5
- v4.3.0.3 Build ID: 08ebe52789a201dd7d38ef653ef7a48925e7f9f7
- v4.4.0.0.alpha0+ Build ID: 4aa9b041de3129f19b48e66d349f48657b73f33e (2014-07-19)

Milos if you can confirm this, we may be able to finally mark this bug as RESOLVED and WORKSFORME (unless an identifiable fix can be located, in which case it can be marked FIXED).
Comment 4 Milos Sramek 2014-07-26 14:39:51 UTC
(In reply to comment #3)
> The problem of the formulas in the red row not totalling correctly (and not
> being referenced correctly in the yellow row) seems to be fixed in all these
> versions under GNU/Linux:
> 
> - v4.1.6.2 Build ID: 40ff705089295be5be0aae9b15123f687c05b0a
> - v4.2.5.2 Build ID: 61cb170a04bb1f12e77c884eab9192be736ec5f5
> - v4.3.0.3 Build ID: 08ebe52789a201dd7d38ef653ef7a48925e7f9f7
> - v4.4.0.0.alpha0+ Build ID: 4aa9b041de3129f19b48e66d349f48657b73f33e
> (2014-07-19)
> 
> Milos if you can confirm this, we may be able to finally mark this bug as
> RESOLVED and WORKSFORME (unless an identifiable fix can be located, in which
> case it can be marked FIXED).

Hi,
it still does not work for me. I've tested
Verzia: 4.2.6.1  5fdddf655fba363e34f755715238d0943a44857e
Verzia: 4.3.0.3  08ebe52789a201dd7d38ef653ef7a48925e7f9f7

Did you run the conversion from command line? This way?
/opt/libreoffice4.2/program/soffice --headless --convert-to pdf t.odt
--
m
Comment 5 Owen Genat (retired) 2014-07-28 05:18:48 UTC
(In reply to comment #4)
> Did you run the conversion from command line? 

Oh, sorry. Please disregard comment 3. Still produces the indicated error here also.
Comment 6 under_the_line 2014-07-28 09:19:51 UTC
Hi,

I've tested with
4.2.5.2 (WIN)
4.2.4.2(Ubuntu 14.04)


PHP
$msg = @shell_exec($cmd_prefix.escapeshellarg($libreoffice_path).' --headless --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --invisible --convert-to pdf '.escapeshellarg($path).' --outdir '.escapeshellarg($temp_file_dir));

Command Line

soffice.exe --headless --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --invisible --convert-to pdf test.pdf --outdir test;

/usr/bin/libreoffice --headless --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --invisible --convert-to pdf /home/xxx/test.pdf --outdir /home/xxx/temp

--
Chris
Comment 7 QA Administrators 2015-09-04 02:48:16 UTC Comment hidden (obsolete)
Comment 8 Buovjaga 2015-11-18 12:04:49 UTC
Still repro.

Ubuntu 15.10 64-bit 
Version: 5.1.0.0.alpha1+
Build ID: 7272e8df62a12d6172b297d7a82a0265cd1bc44a
TinderBox: Linux-rpm_deb-x86_64@70-TDF-dbg, Branch:master, Time: 2015-11-15_00:23:07
Locale: en-US (en_US.UTF-8)
Comment 9 Jens Haeuser 2016-11-02 21:06:00 UTC
same error here, trying to convert 10+ odt writer documents incl. a table and some formulars. Everytime I convert the files to PDF using the commandline, the formulars are not evaluated before converting and in the output file you see "expression is faulty" instead of the value.
Comment 10 tommi 2017-04-07 19:15:04 UTC
I can confirm this bug using also .fods format and converting to pdf
Comment 11 QA Administrators 2018-04-08 02:32:47 UTC Comment hidden (obsolete)
Comment 12 Timur 2018-12-07 16:17:34 UTC
*** Bug 92181 has been marked as a duplicate of this bug. ***
Comment 13 Timur 2018-12-07 16:19:29 UTC
*** Bug 98183 has been marked as a duplicate of this bug. ***
Comment 14 Cor Nouws 2018-12-08 21:59:54 UTC
setting various fields conform duplicate bug 98183
Comment 15 Cor Nouws 2018-12-12 20:55:38 UTC
maybe check a build with the fix of bug 121962
looks rather similar :)
Comment 16 Samuel Mehrbrodt (CIB) 2018-12-13 08:05:08 UTC
I just checked and the document no longer displays "Expression invalid", but it has 0 sum instead of the correct sum.
So there is still some bug here.
Comment 17 Samuel Mehrbrodt (CIB) 2018-12-15 14:09:49 UTC
This is fixed now with the commits pushed for bug 121962.

*** This bug has been marked as a duplicate of bug 121962 ***