Bug 125038 - specific DOCX: additional entries from MERGEFIELD not visible in Word are shown in LO Writer
Summary: specific DOCX: additional entries from MERGEFIELD not visible in Word are sho...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.4.0 target:6.3.4 target:7.6.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-30 09:39 UTC by Patrick Jaap
Modified: 2023-02-20 19:46 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
sample docx (12.28 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-04-30 09:40 UTC, Patrick Jaap
Details
LO Writer result (9.56 KB, application/pdf)
2019-04-30 09:40 UTC, Patrick Jaap
Details
MSO result (3.80 KB, application/pdf)
2019-04-30 09:40 UTC, Patrick Jaap
Details
sample docx (11.91 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-04-30 12:30 UTC, Patrick Jaap
Details
Sample DOCX compared MSO LO (127.21 KB, image/png)
2019-10-30 08:02 UTC, Timur
Details
IsFieldNestingAllowed.assert.zip: new examples picked up from crashtesting (1.22 MB, application/zip)
2023-02-17 18:50 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Jaap 2019-04-30 09:39:37 UTC
Description:
The attached document is protected with password "test". In comparison to Office 2010, a lot of additional fields are shown.

I tried to anonymize the file. Original Email is "test@test.test"  and numbers are 1234567890. Some fallback(?) fields are present in the docx-file. I changed these to "x.x@x.x" and the numbers to "XXXXXXXXXX".

MSO shows only the main fields while LO shows everything at once.

Steps to Reproduce:
1. open the file


Actual Results:
all entries are shown

Expected Results:
only the main entries are shown


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Patrick Jaap 2019-04-30 09:40:10 UTC Comment hidden (obsolete)
Comment 2 Patrick Jaap 2019-04-30 09:40:30 UTC
Created attachment 151086 [details]
LO Writer result
Comment 3 Patrick Jaap 2019-04-30 09:40:47 UTC
Created attachment 151087 [details]
MSO result
Comment 4 Patrick Jaap 2019-04-30 12:30:26 UTC
Created attachment 151092 [details]
sample docx
Comment 5 Patrick Jaap 2019-04-30 12:31:55 UTC
I just noticed that the issue does not depend on password protection of the docx file. I uploaded an unprotected version.
Comment 6 Dieter 2019-04-30 13:06:54 UTC
I confirm the described differences with MSO 2016 in comparison to

Version: 6.3.0.0.alpha0+ (x64)
Build ID: 421e6fc3cd2e6fe37afbef341e2d0ad7b8edde37
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-04-07_01:12:58
Locale: en-US (de_DE); UI-Language: en-US
Calc: threaded
Comment 7 Xisco Faulí 2019-05-23 11:49:03 UTC
Also reproduced in

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 8 Timur 2019-09-10 14:23:02 UTC
Inherited from OO. Repro 6.4+.
Inspect in Word found no hidden text nor invisible content. 
Source shows MERGEFIELD which is Merge Field Formatting in Microsoft Word.

Word shows:

Telefon (dienstl.): 	1234567890
Fax:	1234567890
E-Mail:	test@test.test

Alt+F9 in Word shows:

{IF{MERGEFIELD Kun_Telefon_Dienst}="" "" "Telefon (dienstl.): {MERGEFIELD
Kun_Telefon_Dienst}
"}{IF{MERGEFIELD Kun_Telefon_Privat}="" "" "Telefon (privat): {MERGEFIELD
Kun_Telefon_Privat}
"}{IF{MERGEFIELD Kun_Mobil } = "" "" "Telefon (mobil): {MERGEFIELD Kun_Mobil}
"}{IF{MERGEFIELD Kun_Fax}="" "" "Fax: {MERGEFIELD Kun_Fax}
"}{IF{MERGEFIELD Kun_Mail}="" "" "E-Mail: {MERGEFIELD Kun_Mail}
"}

"Update Field" shows fields. Probably because there's no source. 

LO shows:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Telefon (dienstl.): 	1234567890123456
«Kun_Mobil»
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Fax:	1234567890x.x@x.xx.x@x.x
test@test.test
E-Mail:
Comment 9 Commit Notification 2019-10-28 17:08:18 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7b0534cb70e96028c8525285c42a71415704cede

Related: tdf#125038 DOCX import: fix unexpected MERGEFIELD result inside IF

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Timur 2019-10-30 08:02:39 UTC
Created attachment 155407 [details]
Sample DOCX compared MSO LO

Looks better, but still somewhat different from MSO.
Comment 11 Miklos Vajna 2019-10-30 08:20:57 UTC
Timur: thanks, this is expected. I'll set the bug state to resolved when I believe the bug is fixed, then Patrick will probably test the result. :-)
Comment 12 Patrick Jaap 2019-10-30 08:36:54 UTC
(In reply to Miklos Vajna from comment #11)
>  then Patrick will probably test the result. :-)
That's right ;)
Comment 13 Commit Notification 2019-10-30 21:03:25 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/97f9af714ea1c46e498fa99f7ca34fc1708d38a6

Related: tdf#125038 DOCX import: fix unexpected linebreak inside IF condition

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2019-10-31 11:36:43 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d09336fbdceaafd9320466b660a2b32a07dcc16a

tdf#125038 DOCX import: fix lost MERGEFIELD result inside an IF field

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2019-10-31 17:15:41 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d40c2be38aaf56116f4dc7be9e78f4e9695407fc

tdf#125038 DOCX import: better support for linebreaks in IF fields

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Miklos Vajna 2019-10-31 17:21:14 UTC
I think this is now fixed on master.
Comment 17 Patrick Jaap 2019-11-01 10:15:00 UTC
I can confirm the bug is fixed in master! Thanks!

Can we get a backport to 6.3?
Comment 18 Miklos Vajna 2019-11-04 08:01:27 UTC
Sure, I'll post backports for review to gerrit soon.
Comment 19 Commit Notification 2019-11-05 14:14:19 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/58d798ea44b9e2a57681e990a8acc747bc287c0b

tdf#125038 DOCX import: fix various issues with MERGEFIELD inside IF fields

It will be available in 6.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2023-01-20 20:22:26 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c6cf80af60d23fc52502f88f24dc23ad85462e77

related tdf#125038 FORMTEXT/REF:fix spurious text outside IF field

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Justin L 2023-02-17 18:50:03 UTC
Created attachment 185448 [details]
IsFieldNestingAllowed.assert.zip: new examples picked up from crashtesting

In https://gerrit.libreoffice.org/c/core/+/145931/2 I created an assert looking for new example documents that used fields other than the ones already investigated. Those are attached in this zip file.
Comment 22 Justin L 2023-02-20 19:46:21 UTC
(In reply to Justin L from comment #21)
> IsFieldNestingAllowed.assert.zip: new examples picked up from crashtesting

Most of the IF FIELDS in these are very complex. I didn't find any document that pointed a clear path. Some looked better when returning true, others looked better when returning false.