Created attachment 145284 [details] Sample DOCX The attached DOCX file contains a Text Form Field (Legacy Form control), which has a bookmark (Text1). It also contains a cross reference (field of type Ref) referencing the bookmark. The document is protected, only filling in the form is allowed. If the text field is filled, when previewing Print, the reference is updated (in Writer this has to be the Print dialog, Print Preview doesn't have the same effect; alternatively press F9). - In Writer, fill the text field, and press F9. - Save and reopen file. - Type something else in the text field, press F9. => Referencing field becomes empty, which means the cross reference got broken during save. Same effect if the changed file is opened in Word, after updating fields, the referencing field becomes empty. Observed using LO 6.2 daily build (2018-09-2, 8b1501d80dc9d3f42c351c6e026fa737e116cae5), 4.0.0.3 / Windows 7. In 3.5.0.3 the behavior is worse.
Created attachment 145285 [details] Roundtripped broken DOCX
Reproduced with 6.2.0.0.alpha0+ (x64) Build ID: 89a60912bba7ffd6f65ea99f4664f343c5025c95 CPU threads: 8; OS: Windows 10.0; UI render: GL; TinderBox: Win-x86_64@42, Branch:master, Time: 2018-10-01_03:18:33 Locale: de-AT (de_AT); Calc: CL For me there is no difference if I edit the docx file (e.g. to force field updated with F9) or to only open the docx and save it without doing anything. After reopening, pressing F9 makes the reference field empty. BTW the Text Form Field (Legacy Form control) isn't editable in Writer.
confirmed likely inherited from OOo based on bibisect-43all. Spot checks suggest this has never worked. To play around with this document, you can unprotect it via tools-options-Writer-Compatibility and unchecking Protect Form. It appears that the bookmark (or whatever terminology is correct) is still there, because if I Insert->CrossReference->Type=Bookmark,InsertRefTo=Reference,Selection=Text111 then I again get the contents of the text form field (and this time it is preserved across round-trips, although two more bookmarks are again added...)
The commit comments clearly show that I am not at all confident in working on this bug. But the results of these patches work very nicely on this test document, and don't break any of the two existing unit tests featuring text controls (fdo53985.docx and tdf111964.docx) - which is all I have to work with. https://gerrit.libreoffice.org/61615 tdf120224 writerfilter: consume excess bookmark from fields https://gerrit.libreoffice.org/61616 tdf120224 docx export: don't double up field bookmarks
fixed in 6.2 with commits 579c0749bef8c980507229439715e72060c1b077 and 0a452b5005744d96f37fcb29b37a84e23a04bf8e.
Michael Stahl committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ae97beb73efca8e31a7b2d93d55bdb118711d72a tdf#120224 writerfilter: don't suppress all bookmarks inside 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.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7f84c993d3d2b5f05b18e740fea960901da57f80 tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark It will be available in 25.2.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.
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-24-8": https://git.libreoffice.org/core/commit/9eacd3d6dda69b7c7c22c5168508287a10204b57 tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark It will be available in 24.8.3. 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.
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-24-2": https://git.libreoffice.org/core/commit/1a4baa7d2907a9a3317b25762cbe11ae27389fea tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark It will be available in 24.2.7. 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.