Bug 120972 - Columns created using decimal point tab in ruler become misaligned in docx files
Summary: Columns created using decimal point tab in ruler become misaligned in docx files
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Tünde Tóth
URL:
Whiteboard: target:7.5.0 target:7.4.1
Keywords: bibisectRequest, filter:docx, regression
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2018-10-27 15:48 UTC by David K
Modified: 2022-08-12 13:17 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Screenshot showing how decimal points are not properly aligned but offset when saving, closing, then reopening a docx file in LibreOffice Writer (44.26 KB, image/jpeg)
2019-10-11 06:40 UTC, David K
Details
The docx file from which the screenshot was taken (4.08 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-10-11 06:41 UTC, David K
Details
<spam> (2.49 KB, text/plain)
2020-08-01 07:35 UTC, Reyy kakeru
Details
<spam> (2.49 KB, text/plain)
2020-08-01 07:37 UTC, Reyy kakeru
Details
Decimal tabulator made with English locale (10.49 KB, application/vnd.oasis.opendocument.text)
2020-12-31 11:01 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with English locale, saved as docx by Writer (4.34 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-12-31 11:02 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with English locale, in odt and docx in Writer (70.71 KB, image/png)
2020-12-31 11:03 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with English locale, odt in Writer and docx in Word (51.66 KB, image/png)
2020-12-31 11:04 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with Hungarian locale (8.77 KB, application/vnd.oasis.opendocument.text)
2020-12-31 11:04 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with Hungarian locale, saved as docx by Writer (4.25 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-12-31 11:06 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with Hungarian locale, in odt and docx in Writer (66.71 KB, image/png)
2020-12-31 11:06 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with Hungarian locale, odt in Writer and docx in Word (52.38 KB, image/png)
2020-12-31 11:07 UTC, NISZ LibreOffice Team
Details
Decimal tabulator made with Word 2013 (11.35 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-12-31 11:07 UTC, NISZ LibreOffice Team
Details
Decimal tabulator document from Word in Writer and Word side by side (95.69 KB, image/png)
2020-12-31 11:08 UTC, NISZ LibreOffice Team
Details
en_US document with currency number format usage with thousand separator , (5.01 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-07-22 13:47 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David K 2018-10-27 15:48:59 UTC
Description:
When creating new tabs in the ruler with the data aligned based on the decimal point, this works with odt files and doc files, but if the document is saved as a docx file, is closed, and is then re-opened, all of the columns now appear misaligned.

Steps to Reproduce:
1. Create tabbed column of numerical data using decimal point tab in ruler
2. Save as docx file
3. Reopen file

Actual Results:
Column is misaligned upon reopening the file

Expected Results:
Column should be unaffected upon reopening


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Comment 1 Xisco Faulí 2018-11-12 14:47:02 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 David K 2019-10-11 06:40:39 UTC
Created attachment 154918 [details]
Screenshot showing how decimal points are not properly aligned but offset when saving, closing, then reopening a docx file in LibreOffice Writer
Comment 3 David K 2019-10-11 06:41:35 UTC
Created attachment 154919 [details]
The docx file from which the screenshot was taken
Comment 4 Dieter 2019-10-17 06:06:54 UTC
David, please add the original odt-file, to make the difference clear. Please also make sure, that you're using an actual version of LO (please paste informations from HELP => About LibreOffice

=> NEEDINFO
Comment 5 David K 2020-01-19 12:04:52 UTC
This bug pertains to docx files, so there is no "original odt file."

My version:
Version: 6.1.5.2
Build ID: 1:6.1.5-3+deb10u5
CPU threads: 8; OS: Linux 4.19; UI render: default; VCL: gtk3_kde5; 
Locale: en-US (en_US.UTF-8); Calc: group threaded
Comment 6 Xisco Faulí 2020-01-20 11:30:00 UTC
You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
else confirms it.
Comment 7 Dieter 2020-01-20 11:57:34 UTC
(In reply to David K from comment #5)
> My version:
> Version: 6.1.5.2
> Build ID: 1:6.1.5-3+deb10u5
> CPU threads: 8; OS: Linux 4.19; UI render: default; VCL: gtk3_kde5; 
> Locale: en-US (en_US.UTF-8); Calc: group threaded

David, could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ? I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version. Change to RESOLVED WORKSFORME, if the problem went away.
Comment 8 David K 2020-06-24 09:24:36 UTC
This bug is still present in Version: 6.4.4.2.
Comment 9 Rania Amina 2020-07-04 04:02:58 UTC
I tried this issue as explained in the step to reproduce, but nothing happen, I mean, no misaligned columns after i reopen the DOCX document. 

Versi: 6.4.5.2
ID Build: 1:6.4.5-1
Thread CPU: 12; OS: Linux 5.7; Render UI: baku; VCL: kf5; 
Locale: id-ID (id_ID.UTF-8); Bahasa-UI: id-ID
Calc: threaded
Comment 10 Dieter 2020-07-21 06:11:25 UTC
(In reply to David K from comment #5)
> This bug pertains to docx files, so there is no "original odt file."

Regarding to your steps in the bug decription, there is an odt-file after step 1 and you save it as docx in step 2. Correct?
Comment 11 David K 2020-07-21 06:20:00 UTC
No, so a new file is created and then later on is saved as a docx file.
Comment 12 Dieter 2020-07-21 06:30:25 UTC
(In reply to David K from comment #11)
> No, so a new file is created and then later on is saved as a docx file.

But the new file is an odt-file, until you save it as docx, isn't it?
Comment 13 David K 2020-07-21 06:33:51 UTC
I mean to produce the error, I only save the file once as a docx file.
Comment 14 Dieter 2020-07-21 08:31:29 UTC
(In reply to David K from comment #13)
> I mean to produce the error, I only save the file once as a docx file.

So please save it as odt instead of docx and add it as attachment.
Comment 15 Reyy kakeru 2020-08-01 07:35:49 UTC Comment hidden (spam)
Comment 16 Reyy kakeru 2020-08-01 07:37:14 UTC Comment hidden (spam)
Comment 17 Aron Budea 2020-08-04 08:23:57 UTC
Setting status to NEEDINFO per Dieter's comment.
Comment 18 NISZ LibreOffice Team 2020-12-31 10:59:37 UTC
This is a tricky situation.
The decimal tabulator can have an arbitrary decimal separator set in Writer.
Word on the other hand does not have such a feature, so docx format does not support at save time storing the arbitrary decimal separators set in Writer.

What happens at export time is that the separators are not saved at all, and at import time they are imported as comma.

The difference in display is also locale-specific when comparing editing a new file.
The default decimal separator used for decimal tabulators matches the locales default: usually dot (English) or comma (such as German or Hungarian). 
This makes the editor align the numbers to the decimal tabulator if they contain the locale-default separator, which is intuitive.

With locales using dot the docx save and reload messes up the layout, since reopening the file changes the separator to comma. If they used numbers with dot as separator, that is now left-aligned since it does not contain the expected comma.

Word on the other hand does not support custom decimal separator, what it does is that it supports all kinds of non-number character separators for decimal type tabulators.
So whether a Writer-saved docx file originally aligned numbers to a dot or comma does not matter in Word, it will align both variation to the decimal tab.

I'll attach a few example files and screenshots to document what's going on.
Comment 19 NISZ LibreOffice Team 2020-12-31 11:01:19 UTC
Created attachment 168593 [details]
Decimal tabulator made with English locale
Comment 20 NISZ LibreOffice Team 2020-12-31 11:02:32 UTC
Created attachment 168594 [details]
Decimal tabulator made with English locale, saved  as docx by Writer
Comment 21 NISZ LibreOffice Team 2020-12-31 11:03:44 UTC
Created attachment 168595 [details]
Decimal tabulator made with English locale, in odt and docx in Writer
Comment 22 NISZ LibreOffice Team 2020-12-31 11:04:18 UTC
Created attachment 168596 [details]
Decimal tabulator made with English locale, odt in Writer and docx in Word
Comment 23 NISZ LibreOffice Team 2020-12-31 11:04:53 UTC
Created attachment 168597 [details]
Decimal tabulator made with Hungarian locale
Comment 24 NISZ LibreOffice Team 2020-12-31 11:06:31 UTC
Created attachment 168598 [details]
Decimal tabulator made with Hungarian locale, saved as docx by Writer
Comment 25 NISZ LibreOffice Team 2020-12-31 11:06:55 UTC
Created attachment 168599 [details]
Decimal tabulator made with Hungarian locale, in odt and docx in Writer
Comment 26 NISZ LibreOffice Team 2020-12-31 11:07:18 UTC
Created attachment 168600 [details]
Decimal tabulator made with Hungarian locale, odt in Writer and docx in Word
Comment 27 NISZ LibreOffice Team 2020-12-31 11:07:32 UTC
Created attachment 168601 [details]
Decimal tabulator made with Word 2013
Comment 28 NISZ LibreOffice Team 2020-12-31 11:08:01 UTC
Created attachment 168602 [details]
Decimal tabulator document from Word in Writer and Word side by side
Comment 29 László Németh 2022-07-22 13:32:14 UTC
This is a regression from commit c0b6aadedc9429eee4f4df85957e00e29ccb0c8f
"(related: fdo#81033) writerfilter: default tab fill character is space".
Comment 30 László Németh 2022-07-22 13:47:19 UTC
Created attachment 181377 [details]
en_US document with currency number format usage with thousand separator ,

E.g. "45,454,435.00 USD". Formatting can be handled by Writer correctly, depending on the locale. But the reported regression resulted bad decimal alignment, related to the comma, as fixed decimal separator for all languages.
Comment 31 László Németh 2022-07-22 13:50:11 UTC
Number formats with thousand separators are handled by text tables in Writer, see Table->Number format..., see attached test document "en_US document with currency number format usage with thousand separator",

It seems, we could only fix the import based on the locale settings of LibreOffice, solving the original bug report by partial revert of commit c0b6aadedc9429eee4f4df85957e00e29ccb0c8f, removing this line:

writerfilter/source/dmapper/DomainMapper_Impl.hxx:        DecimalChar = ',';

Note: The "ugly" problem mentioned in that commit  doesn't occur any more.
Comment 32 Commit Notification 2022-07-31 22:04:14 UTC
Tünde Tóth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#120972 DOCX: fix import of decimal tabulators

It will be available in 7.5.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 33 Commit Notification 2022-08-03 10:30:37 UTC
Tünde Tóth committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/7e93946fc5252a2437f05400dba02dd5bf5140c5

tdf#120972 DOCX: fix import of decimal tabulators

It will be available in 7.4.1.

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.