Bug 114537 - Filesave: Export ConditionalText field to DOC
Summary: Filesave: Export ConditionalText field to DOC
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.6.0
Keywords: filter:doc, filter:docx
Depends on: 43569
Blocks: DOCX-Fields
  Show dependency treegraph
 
Reported: 2017-12-18 14:17 UTC by Timur
Modified: 2023-02-17 18:51 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
tdf114537_conditionalText.odt: minimal example of true and false conditions (12.65 KB, application/vnd.oasis.opendocument.text)
2023-01-17 18:14 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timur 2017-12-18 14:17:58 UTC
With fix in Bug 43569, "fileopen2 and "save as ODT" of conditional fields in attachment 56010 [details] are fixed in 6.1+. 
This bug is to export ConditionalText field to DOC/DOCX.
Comment 1 Stéphane Guillou (stragu) 2021-06-22 13:17:12 UTC
Export of conditional text to DOC and DOCX still doesn't work in the current daily build:

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: e3086b58eb5427d520b86c185f9d911bb6f7a3a0
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-06-21_15:37:11
Calc: threaded

In my tests:
- in the DOC, the variable it depends on still exists, but does not display its current value. Conditional text is entirely lost.
- in the DOCX, the variable it depends on works as expected, but the conditional text only displays its last value when the file was saved, and modifying the document in any way makes the value disappear. Editing the conditional text field shows that there is no condition defined, and no values for "Then" or "Else.
Comment 2 Justin L 2023-01-17 18:14:19 UTC
Created attachment 184716 [details]
tdf114537_conditionalText.odt: minimal example of true and false conditions

It is worth noting that "1.doc" does not import properly. The true/false text is considered part of the conditional statement.

So I have included an ODT file to use for exporting.  NOTE that import of DOCX doesn't work, so any testing needs to be done in MS Word.

Testing LO 7.6 master. No field is exported at all in DOC format. It is reasonably well exported to DOCX format, except that it has too many quotation marks and thus fails.
Comment 3 Justin L 2023-01-17 18:43:06 UTC
The DOCX export was added in LO 7.1 with
commit 5d839ff8a81ade6453a239a258b2a2571e32001e
Author: Miklos Vajna on Fri Nov 13 16:26:43 2020 +0100
    DOCX export: handle conditional fields
    
    At least the subset where the condition syntax matches between Writer
    and Word.
Comment 4 Commit Notification 2023-01-17 22:19:27 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/98550980e414ca6d611e6c3779eed2e5e66f5641

tdf#114537 docx export: export conditional text in quotes

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 5 Commit Notification 2023-01-18 03:32:55 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/29f23c0e71437303982a094040373b509afc7010

tdf#114537 docx export: export conditional text with " as '

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 6 Commit Notification 2023-01-18 13:46:03 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#114537 doc import: trim switches before evaluating FIELD_IF

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 7 Commit Notification 2023-01-18 20:55:02 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#114537 doc/rtf export: move DOCX impl so all formats use it

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.