Download it now!
Bug 125300 - DOCX Import Line spacing inside tables are handled differently in MS Word and LibreOffice causing different document layout
Summary: DOCX Import Line spacing inside tables are handled differently in MS Word and...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: László Németh
URL:
Whiteboard: target:6.5.0 target:6.4.0.1
Keywords: filter:docx
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2019-05-15 09:12 UTC by NISZ LibreOffice Team
Modified: 2020-03-24 17:03 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
The original file (13.82 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-05-15 09:13 UTC, NISZ LibreOffice Team
Details
A screenshot showcasing the issue. (134.30 KB, image/png)
2019-05-15 09:13 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2019-05-15 09:12:31 UTC
Description:
The line spacing paragraph setting is handled differently in Microsoft Word and LibreOffice Writer inside tables: in Microsoft Word, the line spacing is also applied to the last line of the paragraph, effectively working as a spacing between the paragraph and the bottom cell border. In LibreOffice, the line spacing doesn't affect the padding between the last line and the cell border. This makes the same table smaller in LibreOffice Writer than in Microsoft Word when opening a DOCX document with such properties.

Steps to Reproduce:
    1. Create a new document in LibreOffice Writer or Microsoft Word (the issue can be reproduced both ways).
    2. Insert a table with one row and write a line of text in a cell.
    3. Select the text in the cell and change line spacing in the paragraph settings to double.
    4. Save the document as DOCX.
    5. Open the same document both in LibreOffice Writer and Microsoft Word and compare them.

Actual Results:
The line spacing in Microsoft Word is also applied to the last line of the paragraph, effectively working as a spacing between the paragraph and the bottom cell border, while in LibreOffice the line spacing doesn't affect the padding between the last line and the cell border.

Expected Results:
LibreOffice should handle the line spacing after last line in a table just like Microsoft Word when editing a DOCX file – maybe offering this behavior as a compatibility option for Writer through Tools > Options > LibreOffice Writer > Compatibility to avoid problems with other file formats or existing documents.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 NISZ LibreOffice Team 2019-05-15 09:13:00 UTC
Created attachment 151425 [details]
The original file
Comment 2 NISZ LibreOffice Team 2019-05-15 09:13:18 UTC
Created attachment 151426 [details]
A screenshot showcasing the issue.
Comment 3 Roman Kuznetsov 2019-05-15 10:33:10 UTC
repro in

Version: 6.3.0.0.alpha0+
Build ID: 773ac3abbf8ab1343367e51b1774d2ee1f8c4f49
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded

it's the same behaviour from scratch in LO and ODT format

you set up double line spacing but you'll see it only after inserting of second line of text in cell!
Comment 4 Xisco Faulí 2019-05-22 16:26:36 UTC
Also reproduced in

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 5 Commit Notification 2019-11-21 18:51:05 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2c918aa51e5528b090e52fa31b10fa17cf2593ae

tdf#125300 extend AddParaSpacingToTableCells with line spacing

It will be available in 6.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 6 László Németh 2019-11-21 18:52:23 UTC
tdf#125300 extend AddParaSpacingToTableCells with line spacing

Now default compatibility mode AddParaSpacingToTableCells uses
not only paragraph bottom margin, but also proportional line
spacing before bottom cell border, as in MSO.
Comment 7 László Németh 2019-11-21 19:32:31 UTC
AddParaSpacingToTableCells mode is about MSO table layout interoperability:

http://specs.openoffice.org/writer/compatibility/formatting-table-cells.sxw

Details:

= Adjust the formatting of table cells =

= Abstract =
Change the formatting of table cells controlled by a compatibility option to meet the requirements of the interoperability to MS Word. The change consists of adding the set paragraph below of the last paragraph inside a table cell to the height of the table cell.

1 Motivation

MS Word and Writer have different approaches on the formatting of table cells in documents. To enhance interoperability between these products as well as to lower the threshold for users to migrate to Writer it is mandatory to adapt certain behaviour from MS Word and integrate them into Writer. Changing the formatting of table cells addresses this difference.

2 User Scenarios

A user gets an MS Word document and opens it within Writer. The person who designed the MS Word document made heavy use of tables.
Thus the layout of the MS Word document relies heavily on the height of the table cells.
If the to-be-imported document contains paragraphs in table cells with a set paragraph spacing below, the layout of the Writer doesn't reflect this.
Once this specification is implemented the user will have less layout loss in this case when importing and of course exporting the document into/from Writer.

3 Goals

Goal of this specification is to enhance the interoperability with MS Word.
Comment 8 László Németh 2019-11-21 19:34:36 UTC
Paragraph spacing before bottom table border is based on also line spacing, not only on paragraph margin in MSO.

With the previous fix the reported proportional line spacing problem has been solved, but it's possible, that later we need to extend it for the other line spacing settings, too.
Comment 9 Commit Notification 2019-11-22 07:02:00 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/3cccdabf19a99fd3f657985c1822436d7679df2b

tdf#125300 extend AddParaSpacingToTableCells with line spacing

It will be available in 6.4.0.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.