Bug 107410 - FILEOPEN RTF: "Expression is faulty" instead of numbers (take alternate part if formula parsing fails)
Summary: FILEOPEN RTF: "Expression is faulty" instead of numbers (take alternate part ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected
: 111460 (view as bug list)
Depends on:
Blocks: RTF Regressions-expression-is-faulty
  Show dependency treegraph
 
Reported: 2017-04-25 10:50 UTC by Xisco Faulí
Modified: 2023-08-16 03:05 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
comparison MSO 2010 and LibreOffice 5.4 (104.08 KB, image/png)
2017-04-25 10:51 UTC, Xisco Faulí
Details
How it looks in LibreOffice 7.1 master (92.71 KB, image/png)
2020-09-15 15:59 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2017-04-25 10:50:22 UTC
Steps to reproduce:
1. Open attachment 84867 [details] from bug 68715
2. Go to page 5

Observed behaviour: Table contains some ** Expression is faulty ** instead of numbers

Reproduced in

Version: 5.4.0.0.alpha0+
Build ID: 7635e0c1c7f821a1081f8e3868f641ae74a172d6
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk2; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

but not in

Version: 5.4.0.0.alpha0+
Build ID: 5a5889d1e1bd17c16930b2132d8c2674fb7fa05a
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk2; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 1 Xisco Faulí 2017-04-25 10:51:32 UTC
Created attachment 132826 [details]
comparison MSO 2010 and LibreOffice 5.4
Comment 2 Jacques Guilleron 2017-04-25 12:35:31 UTC
Hello Xisco,

I reproduce too with:
LO 5.4.0.0.alpha0+ Build ID: 100e00fd3273536ebff130cfddc5da2b1fe609b1
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-04-20_05:12:24
Locale: en-US (fr_FR); Calc: CL
and 
LO 5.4.0.0.alpha0+ Build ID: 98ebfb6a8638a76e96ffe7ada2485b3d13ed1fb9
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-04-11_01:03:05
Locale: fr-FR (fr_FR); Calc: CL

but not with:
LO 5.4.0.0.alpha0+ Build ID: 1cd7edadfedc8bf55b979449cbb084082a888e89
CPU threads: 2; OS: Windows 6.1; UI render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-03-30_03:06:30
Locale: fr-FR (fr_FR); Calc: CL
Comment 3 Xisco Faulí 2017-04-27 00:02:22 UTC
Regression introduced by:

author	Jean-Sebastien Bevilacqua <realitix@gmail.com>	2017-02-16 09:54:33 (GMT)
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-03-30 17:39:00 (GMT)
commit c568eb7d3bb4584867f0a1f0a7965f73097f009b (patch)
tree ea7e6fb1e0d77369a90bc69dd8756f589bb352e4
parent 53c2507bf97867011fd2bfbbac6c86b7fc494338 (diff)
tdf#105975 Add Formula field parsing (docx) in SWriter
Introduction
------------

In MSWord, you can create a formula field (starting with =).
When you save your file as `docx`, this `FORMULA` field is registered
in you file (a field starting with `=`). In its current state,
LibreOffice can't parse the `FORMULA` field in `docx` file.

Context of this fix
-------------------

This fix is entirely located in the `DomainMapper_Impl.cxx` file
because it's where the parsing is done.

How this fix works
------------------

First, we add `FORMULA` support by adding it to the `aFields[]` variable.
Next, to handle the `FORMULA` constant, we add a condition (swith case) in
`DomainMapper_Impl::CloseFieldCommand()` to call `handleFieldFormula`.

Note
----

In function `lcl_ExtractToken`, if command starts with `=`, it's a
`FORMULA` field.

Bisected with

Adding Cc: to Jean-Sebastien Bevilacqua
Comment 4 Jean-Sebastien Bevilacqua 2017-05-19 08:55:03 UTC Comment hidden (obsolete)
Comment 5 Jean-Sebastien Bevilacqua 2017-05-19 09:23:17 UTC
Before my patch, your document was not properly handled either.
If you take a look, the fields have a grey background but are not seen as "field" and can be directly modified.
Comment 6 Jean-Sebastien Bevilacqua 2017-05-19 09:43:50 UTC
Your rtf document contains bookmarks defined as =C6 or =SUM(C12:C27).
Theses references don't seem to exist.

Moreover, in your file, some fields are defined as formula and others not.

Can you give more informations on this file, how do you generate it ?

The error you see come from the field formula format like this:

=curr_emp+curr_adm \\# "#,##0"

The last part is not supported, I should convert it to

=curr_emp+curr_adm

BUT it will no resolve your problem since variable curr_emp and curr_adm are not well defined.
Before the patch, LibreOffice was taking the alternate part of the field because it couldn't parse it. Now it can parse it (badly).

Jean-Sébastien Bevilacqua
Comment 7 Xisco Faulí 2017-05-19 12:14:51 UTC
Hi Jean-Sebastien,

Thanks for taking a look at it.
To be honest, I don't know how the document was generated. As I mentioned in the summary, it's taken from another bug report. I just noticed before and after your commit it was different, but I don't have more technical details.
Comment 8 Jean-Sebastien Bevilacqua 2017-05-19 12:51:04 UTC
A solution would be to try parsing the formula and to take the alternate part if parsing fails.
Comment 9 Xisco Faulí 2017-07-20 15:06:28 UTC
Same problem affects attachment 52931 [details] from bug 41679
Comment 10 Xisco Faulí 2017-08-07 19:31:57 UTC
*** Bug 111460 has been marked as a duplicate of this bug. ***
Comment 11 QA Administrators 2018-08-08 02:36:49 UTC Comment hidden (obsolete)
Comment 12 Timur 2018-08-08 14:26:01 UTC
Repro 6.2+
Comment 13 Xisco Faulí 2019-02-12 10:43:01 UTC
Formulas

debug:8159:8159: =curr_turn \# "#,##0"
debug:8159:8159: =prev_turn \# "#,##0"
debug:8159:8159: =curr_turn \# "#,##0"
debug:8159:8159: =prev_turn \# "#,##0"
debug:8159:8159: =curr_emp+curr_adm \# "#,##0"
debug:8159:8159: =prev_emp+prev_adm \# "#,##0"
debug:8159:8159: =abs(curr_turn-curr_emp-curr_adm) \# "#,##0"
debug:8159:8159: =abs(prev_turn-prev_emp-prev_adm) \# "#,##0"
debug:8159:8159: =curr_int \# "#,##0"
debug:8159:8159: =prev_int \# "#,##0"
debug:8159:8159: =abs(curr_turn-curr_emp-curr_adm+curr_int) \# "#,##0"
debug:8159:8159: =abs(prev_turn-prev_emp-prev_adm+prev_int) \# "#,##0"
debug:8159:8159: =curr_emp \# "#,##0"
debug:8159:8159: =prev_emp \# "#,##0"
debug:8159:8159: =curr_turn \# "#,##0"
debug:8159:8159: =prev_turn \# "#,##0"
debug:8159:8159: =curr_emp \# "#,##0"
debug:8159:8159: =prev_emp \# "#,##0"
debug:8159:8159: =curr_adm \# "#,##0"
debug:8159:8159: =prev_adm \# "#,##0"
debug:8159:8159: =curr_emp+curr_adm \# "#,##0"
debug:8159:8159: =abs(curr_turn+curr_int-curr_emp-curr_adm) \# "#,##0"
debug:8159:8159: =abs(prev_turn+prev_int-prev_emp-prev_adm) \# "#,##0"
debug:8159:8159: =C6 \# "#,##0"
debug:8159:8159: =SUM(C12:C27) \# "#,##0"
debug:8159:8159: =curr_emp+curr_adm \# "#,##0"

Removing the regression keyword...
Comment 14 Xisco Faulí 2020-09-15 15:58:37 UTC
This has improved in

Version: 7.1.0.0.alpha0+
Build ID: 6f1e02c96b887750f974c187a82ecd6236e6a435
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 15 Xisco Faulí 2020-09-15 15:59:00 UTC
Created attachment 165543 [details]
How it looks in LibreOffice 7.1 master
Comment 16 QA Administrators 2023-08-16 03:05:45 UTC
Dear Xisco Faulí,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug