Bug 152857 - Field date format settings are not saved in the template
Summary: Field date format settings are not saved in the template
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-03 08:48 UTC by Oleksa Stasevych
Modified: 2023-01-06 08:33 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
How I am setting user defined date format (36.17 KB, image/png)
2023-01-03 08:50 UTC, Oleksa Stasevych
Details
Date field is saved when used OO native format (42.07 KB, image/png)
2023-01-06 08:05 UTC, Oleksa Stasevych
Details
date field is not saved if the format is MS DOTX (37.89 KB, image/png)
2023-01-06 08:06 UTC, Oleksa Stasevych
Details
A sample ODT with a single mail merge field having an extended date format (9.04 KB, application/vnd.oasis.opendocument.text)
2023-01-06 08:33 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleksa Stasevych 2023-01-03 08:48:23 UTC
Description:
In the Writer template the user-defined field date format is not preserved after closing and opening back the file. 

Steps to Reproduce:
1. Create a template file
2. Add date field
3. Define own format of the date field eg D MM YYYY
4. Save the template in the dotx format
5. Open back it and observe that the date field settings are reset to standard, while the user defined format is not saved

Actual Results:
Open saved template and observe that the date field settings are reset to standard, while the user defined format is not saved

Expected Results:
The user defined format should be saved, as well as the user defined field format.


Reproducible: Always


User Profile Reset: No

Additional Info:
n/a
Comment 1 Oleksa Stasevych 2023-01-03 08:50:27 UTC
Created attachment 184456 [details]
How I am setting user defined date format
Comment 2 Mike Kaganski 2023-01-03 10:54:53 UTC
(In reply to Oleksa Stasevych from comment #0)
> Steps to Reproduce:
> 1. Create a template file
> 2. Add date field
> 3. Define own format of the date field eg D MM YYYY
> 4. Save the template in the dotx format
> 5. Open back it and observe that the date field settings are reset to
> standard, while the user defined format is not saved
> 
> Actual Results:
> Open saved template and observe that the date field settings are reset to
> standard, while the user defined format is not saved

Not reproducible using Version: 7.5.0.1 (X86_64) / LibreOffice Community
Build ID: 77cd3d7ad4445740a0c6cf977992dafd8ebad8df
CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL threaded

(In reply to Oleksa Stasevych from comment #1)
> Created attachment 184456 [details]
> How I am setting user defined date format

But the screenshot shows that you used not a "date field", but a mail merge field? So what did you use actually? And if that's a mail merge field, please attach a sample database with a date field, and an ODT with the mail merge field having a custom format, so that people could test if saving the ODT to DOTX would result in the described problem on their system.
Comment 3 Oleksa Stasevych 2023-01-06 08:05:35 UTC
Created attachment 184502 [details]
Date field is saved when used OO native format
Comment 4 Oleksa Stasevych 2023-01-06 08:06:02 UTC
Created attachment 184503 [details]
date field is not saved if the format is MS DOTX
Comment 5 Oleksa Stasevych 2023-01-06 08:06:18 UTC
(In reply to Mike Kaganski from comment #2)
> (In reply to Oleksa Stasevych from comment #0)
> > Steps to Reproduce:
> > 1. Create a template file
> > 2. Add date field
> > 3. Define own format of the date field eg D MM YYYY
> > 4. Save the template in the dotx format
> > 5. Open back it and observe that the date field settings are reset to
> > standard, while the user defined format is not saved
> > 
> > Actual Results:
> > Open saved template and observe that the date field settings are reset to
> > standard, while the user defined format is not saved
> 
> Not reproducible using Version: 7.5.0.1 (X86_64) / LibreOffice Community
> Build ID: 77cd3d7ad4445740a0c6cf977992dafd8ebad8df
> CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL:
> win
> Locale: ru-RU (ru_RU); UI: en-US
> Calc: CL threaded
> 
> (In reply to Oleksa Stasevych from comment #1)
> > Created attachment 184456 [details]
> > How I am setting user defined date format
> 
> But the screenshot shows that you used not a "date field", but a mail merge
> field? So what did you use actually? And if that's a mail merge field,
> please attach a sample database with a date field, and an ODT with the mail
> merge field having a custom format, so that people could test if saving the
> ODT to DOTX would result in the described problem on their system.

Yes, indeed, that was about the mail merge functionality (I think, quite obsolete title, as it is not about mail merge but preparing the set of typical documents based on some template).

I have re-checked, and found that the issue is related ONLY to DOTX format: so the values are lost if the template is saved in MS format, moreover the date format from the database is not imported properly. I may assume it may be a part of compatibility issues, eg language document property is lost when saved in MS compatible format and re-opened back.
Comment 6 Mike Kaganski 2023-01-06 08:19:22 UTC
(In reply to Mike Kaganski from comment #2)
> please attach a sample database with a date field, and an ODT with the mail
> merge field having a custom format, so that people could test if saving the
> ODT to DOTX would result in the described problem on their system.

(In reply to Oleksa Stasevych from comment #3)
> Created attachment 184502 [details]
> Date field is saved when used OO native format

(In reply to Oleksa Stasevych from comment #4)
> Created attachment 184503 [details]
> date field is not saved if the format is MS DOTX

I tried both screenshots you attached, and surprisingly, I couldn't check the document structure ;)

Please provide the *document* (a database and the ODT), which allows others to see it in action. It's not a matter of providing "proofs" (like in "don't you believe me - I show you the screenshots!"), but a matter of seeing which OTF markup results in which OOXML markup, with a way for tester to play with different file formats (e.g., DOCX vs DOTX), see the difference, check the code that writes specific XML elements...

And expecting testers to invent their own database and mail merge documents is wrong, because the problem could e.g. be specific to some locales, or some database types, or to an OS, etc.
Comment 7 Mike Kaganski 2023-01-06 08:32:27 UTC
Aha, I was able to repro locally.
And this is not specific to DOTX, it happens with DOCX, DOC, RTF.

And this is inevitable, because MS Word file formats have *absolutely no* provisions to store the merge field format:

https://support.microsoft.com/en-us/office/field-codes-mergefield-field-7a6d24a1-68a6-4b05-8359-1dc087daf4e6

It allows to store prefix/suffix, but not the format code or anything else. The field format is always taken from the database.
Comment 8 Mike Kaganski 2023-01-06 08:33:36 UTC
Created attachment 184504 [details]
A sample ODT with a single mail merge field having an extended date format