Bug 149660 - FILEOPEN DOCX IF field conditions not read
Summary: FILEOPEN DOCX IF field conditions not read
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
URL:
Whiteboard:
Keywords: filter:docx
Depends on:
Blocks: 69686 100516 DOCX-Fields 149672 149675
  Show dependency treegraph
 
Reported: 2022-06-21 14:42 UTC by Gabor Kelemen (allotropia)
Modified: 2023-08-16 14:46 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
attachment 56010 saved in Word2016 to docx (10.63 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-06-21 14:42 UTC, Gabor Kelemen (allotropia)
Details
The example file in Word 2016 and Writer master (84.43 KB, image/png)
2022-06-21 14:43 UTC, Gabor Kelemen (allotropia)
Details
The example file in current master and Word 2016 (109.52 KB, image/png)
2023-07-17 22:12 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-06-21 14:42:32 UTC
Created attachment 180873 [details]
attachment 56010 [details] saved in Word2016 to docx

This is related to bug 114537

When the attached file - a docx saved from doc attachment 56010 [details] of bug 43569 - is opened in Writer, the conditional field is recognized, but its Condition, Then and Else parameters are not, as seen in its Edit dialog. 
Consequently, it does not work either.

1, Open attached file in Writer
2, Double click on the test1 field

In the dialog the Condition, Then and Else boxes are empty, but should have the condition as 1=1, Then as test1 and Else as test2.

Word shows it as: IF 1 = 1 "test1" "test2" \* MERGEFORMAT 

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 3b852f274696a5e2a44bb4107c37cea9d291758e
CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

This was never good, tested in 7.0, 6.0, 5.0, 4.0 and 3.5.
Comment 1 Gabor Kelemen (allotropia) 2022-06-21 14:43:00 UTC
Created attachment 180874 [details]
The example file in Word 2016 and Writer master
Comment 2 Cor Nouws 2022-06-21 18:58:37 UTC
confirmed in Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: fc2716740bd513154ae4ab5404d9c575678172e0
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: nl-NL (en_US.UTF-8); UI: nl-NL
Calc: threaded
Comment 3 Justin L 2023-01-19 16:39:52 UTC
Fixing this is a bit dangerous because there are some fundamental differences between LO IF fields and MS Word. Specifically, Word allows nested if statements in the true/false results. Additionally, in MS Word the field content can be manually edited and need to be manually refreshed for the condition to re-apply.

So the field might contain contents that neither match the true or false result-strings. LO has no such ability - which is generally a good thing.
Comment 4 Gabor Kelemen (allotropia) 2023-07-17 22:12:20 UTC
Created attachment 188420 [details]
The example file in current master and Word 2016

Looks much better but not perfect in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 2c524ab87e336418c3ee7370f76284a53dff1c82
CPU threads: 16; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded

after the fix of bug 156030

The condition is not the expected
1 = 1 
but:
1 FORMULA 1