Bug 148380 - FILESAVE DOCX: CreateDate field saved as plain text "DocInformation:Created", etc.
Summary: FILESAVE DOCX: CreateDate field saved as plain text "DocInformation:Created",...
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.4.0
Keywords: filter:docx
Depends on: 147861
Blocks: DOCX-Fields 126636 132475
  Show dependency treegraph
 
Reported: 2022-04-05 05:14 UTC by Justin L
Modified: 2022-05-02 12:18 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2022-04-05 05:14:59 UTC
A DocInfo.CreateDateTime field is not exported as a field in DOCX, but just as a plain text variable name. This has been true at least since LO 3.5. (Since 7.2/7.1.1 the field is always imported as FIXED.)

There are many of these field issues I expect, but each is handled with separate code, so they might as well be handled in separate bug reports as needed.
This is a follow-up of FILEOPEN bug 134592's writerfilter/qa/cppunittests/dmapper/data/create-date-preserve.docx

This is also seen in the header.xml in ooxmlexport14's tdf83309.docx.
Comment 1 Justin L 2022-04-05 08:25:31 UTC
The problem with these documents is that they don't specify any date formatting.
 CREATEDATE \* MERGEFORMAT
 <w:instrText xml:space="preserve"> CREATEDATE </w:instrText>
instead of
 CREATEDATE \@"MM/dd/yy" MERGEFORMAT
 <w:instrText xml:space="preserve"> CREATEDATE \@"HH:mm:ss\ AM/PM" </w:instrText>

Thus it was not treated as a Number Format (empty string), and gets set to bWriteExpand, which just dumps the field name.

I guess the best solution is to make an exception for an empty string. If the formatting causes a string that is not a known number format, then we can continue to dump the field name as an indicator that we are missing support for that.
Comment 2 Justin L 2022-04-07 12:45:46 UTC
These patches depend on one from bug 147861.

https://gerrit.libreoffice.org/c/core/+/132661 tdf#148380 writerfilter: Import AUTHOR as FIXEDFLD

https://gerrit.libreoffice.org/c/core/+/132662 tdf#148380 docx export: support CREATEDATE without format

https://gerrit.libreoffice.org/c/core/+/132663 tdf#148380 doc: Import AUTHOR/CREATEDATE as FIXEDFLD

related followup https://gerrit.libreoffice.org/c/core/+/132664 tdf#148380 docx export: support CHANGEDATE/PRINTDATE without format

related followup https://gerrit.libreoffice.org/c/core/+/132665 tdf#148380 sw ms export: DI_EDIT is simply EDITTIME

https://gerrit.libreoffice.org/c/core/+/132666 tdf#148380 docx export: use content of unknown fields, not name
Comment 3 Commit Notification 2022-04-11 10:24:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/431a0399bb050e65dedb2e9280e744699a724227

tdf#148380 writerfilter: Import AUTHOR as FIXEDFLD

It will be available in 7.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 4 Commit Notification 2022-04-12 09:47:13 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5453721050f1cad2951410cc8d5ebca19ea38294

tdf#148380 docx export: support CREATEDATE without format

It will be available in 7.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 5 Commit Notification 2022-04-13 07:58:05 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/55c7691fadfb9b3a4869cc14432ec57c858f693f

tdf#148380 doc: Import AUTHOR/CREATEDATE as FIXEDFLD

It will be available in 7.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 6 Commit Notification 2022-04-14 11:05:21 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/206efef78ea367de76f000a1760dbd8bc7785b0c

tdf#148380 sw ms export: DI_EDIT is simply EDITTIME

It will be available in 7.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 7 Commit Notification 2022-04-16 03:48:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#148380 docx export: support CHANGEDATE/PRINTDATE without format

It will be available in 7.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 8 Commit Notification 2022-04-18 03:19:36 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#148380 docx export: use content of unknown fields, not name

It will be available in 7.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 9 Commit Notification 2022-04-20 09:03:09 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8e9a963d20edcf5751705bb64126f51a2ace6b18

tdf#148380 sw fieldui: always allow turning off "Fixed Content"

It will be available in 7.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 Commit Notification 2022-04-27 10:04:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4a8ea3d086e03098fcff2a744ccb632f50f173dd

tdf#148380 sw ms: import select fldLock'd fields as FIXED

It will be available in 7.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 11 Justin L 2022-04-28 05:28:39 UTC
Comment 8's patch is the generic fix for the big problem of LO exporting the NAME of the field instead of the CONTENT of the field.

The other patches here were for wiring up the field and variables together in a way that emulates what MS Word does. Several other bug fixes depend on some of these fixes.