Bug 111964 - FILESAVE: Empty input fields in .DOCX not retained
Summary: FILESAVE: Empty input fields in .DOCX not retained
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Mike Kaganski
Whiteboard: target:6.0.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-ActiveX-Legacy
  Show dependency treegraph
Reported: 2017-08-22 12:09 UTC by Timur
Modified: 2017-09-05 18:32 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Timur 2017-08-22 12:09:46 UTC
1. Open attachment 117736 [details] (from Bug 93229 and Bug 94431)
2. Note content is read-only except for gray input fields in the table.
3. Add some content to some of those input fields
4. Save as DOCX and reopen.
5. Note other content is still read-only, which is good, but:
Expected: All input fields and their content are retained. 
Actual: Input fields retained only if there was content there, not if empty. 

DOCX was OK from 5.2 to 5.4, unlike DOC that has it own Bug 52555, and RTF, which has old Bug 94442. 
Looks like a recent regression in 6.0+. If confirmed, please set bibisectRequest.
Comment 1 Timur 2017-08-22 13:16:47 UTC
Looks like this fix from 5.2 was Bug 99434.
Comment 2 raal 2017-08-22 20:17:36 UTC
This seems to have begun at the below commit.
Adding Cc: to Mike Kaganski; Could you possibly take a look at this one? Thanks
 efc773ec387320dda701706434cd1d17092e8647 is the first bad commit
commit efc773ec387320dda701706434cd1d17092e8647
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Sat Jul 29 05:38:45 2017 -0700

    source 7c1a51516aaf2767e43b393259a1ad21570df5fb
author	Mike Kaganski <mike.kaganski@collabora.com>	2017-07-07 08:33:34 (GMT)
committer	Mike Kaganski <mike.kaganski@collabora.com>	2017-07-07 10:52:00 (GMT)
commit 7c1a51516aaf2767e43b393259a1ad21570df5fb (patch)
tree 276c4d2d62307513376295e946cf1f6e398f6aab
parent 350fb0249af7c29c98c3e15415a151bda8fae7ee (diff)
tdf#108995: take xml:space attribute into account
Comment 3 Mike Kaganski 2017-08-22 21:10:56 UTC
The problem identified. My patch uses UOString::trim(), which seems to be trimming all Unicode codepoints with Space category. DOCX uses EN SPACE (U+2002) for placeholders in the fields, and these spaces get trimmed on import. (The exported file opens OK in Word btw.)

Will come with a fix tomorrow.
Comment 4 Mike Kaganski 2017-08-23 07:24:08 UTC
Patch under review: https://gerrit.libreoffice.org/41444
Comment 5 Commit Notification 2017-08-23 11:22:14 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":


tdf#111964: only trim XML whitespace

It will be available in 6.0.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Timur 2017-08-24 15:13:58 UTC
Please set as Fixed. If I do it, script counts me as a fixer, which is not correct. And then I can put Verified.