Bug 164803 - FILEOPEN DOC: text no longer matches MSO layout with grid imposed
Summary: FILEOPEN DOC: text no longer matches MSO layout with grid imposed
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Jonathan Clark
URL:
Whiteboard: target:25.8.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2025-01-22 20:38 UTC by Justin L
Modified: 2025-01-24 01:02 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
ooo47393-2.doc: simple English text with Times New Roman font (7.45 MB, application/msword)
2025-01-22 20:38 UTC, Justin L
Details
ooo47393-2.doc_import-compare-0.png: RED=25.2 master, BLUE=25.2 oldest, grayscale=MSO2019 (71.29 KB, image/png)
2025-01-22 20:41 UTC, Justin L
Details
164803_more_examples.zip: a few additional examples I found (398.63 KB, application/zip)
2025-01-22 20:55 UTC, Justin L
Details
fdo64755-1.doc_import-compare-0.png: RED=25.2 master, BLUE=25.2 oldest, grayscale=Word2019 (117.70 KB, image/png)
2025-01-23 21:08 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2025-01-22 20:38:10 UTC
Created attachment 198681 [details]
ooo47393-2.doc: simple English text with Times New Roman font

I'm seeing many DOC files where the spacing is no longer correct.

Steps to reproduce:
1.) open ooo47393-2.doc

Page 2 should start with "Mom!  Mom!".

Also seen with ooo393057-1, forum-mso-en-3196, and many more.
But this patch has improved tdf85430-1.
Comment 1 Justin L 2025-01-22 20:41:27 UTC
Created attachment 198682 [details]
ooo47393-2.doc_import-compare-0.png: RED=25.2 master, BLUE=25.2 oldest, grayscale=MSO2019

Prior to 25.2, the overlay was essentially identical to MSO. Now a lot of red is showing - and in the end an extra page is used.

Found by Collabora's mso-test.
Comment 2 Justin L 2025-01-22 20:44:05 UTC
bibisected to 25.2 commit 2155684c819dcdc52968c59276046fb0cad83561
Author: Jonathan Clark on Thu Sep 19 22:05:08 2024 -0600
    tdf#129808 sw: Use ext leading for text grid spacing on DOC import
Comment 3 Justin L 2025-01-22 20:55:47 UTC
Created attachment 198683 [details]
164803_more_examples.zip: a few additional examples I found
Comment 4 Jonathan Clark 2025-01-23 14:16:53 UTC
Document layout is affected by the MS_WORD_COMP_GRID_METRICS compatibility flag, even though it doesn't have a grid.
Comment 5 Justin L 2025-01-23 21:08:57 UTC
Created attachment 198720 [details]
fdo64755-1.doc_import-compare-0.png: RED=25.2 master, BLUE=25.2 oldest, grayscale=Word2019

FFC252FFCSW_Chart_Paragraph0010.doc (aka fdo64755-1.doc, attachment 79515 [details] from bug 64755) might be an interesting example related to this bug.
It changed with commit 2b030ded43f440a898733290af087d4aeed53368
Author: Jonathan Clark on Fri Sep 20 00:50:21 2024 -0600
    tdf#85435 sw: No longer clear AddExtLeading for doc files with grid
Comment 6 Commit Notification 2025-01-23 21:39:18 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/43fc662520e5488cbeadd6eb60a24374a837dca4

tdf#164803 sw: Fix SwTextSizeInfo applying grid metrics without grid

It will be available in 25.8.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 Jonathan Clark 2025-01-23 21:52:19 UTC
This change fixes the ooo47393, forum-mso-en-3106, and ooo39439-1 cases.

The ooo39057-1 case is due to an unrelated DOC import bug. When we import this file in LO, the first lines are flagged snap-to-grid. Microsoft Word treats them as though they aren't.

You can verify this in Word by selecting the word "License" and adjusting the font size up and down. Note that the line doesn't skip to a different grid row. Now select the word "Please" from the third line and repeat the process. The line skips to different grid rows as the size increases.

Strangely, the Word UI shows the paragraph style as snap-to-grid. However, if you convert to DOCX and look at the XML, snap-to-grid is indeed disabled.
Comment 8 Justin L 2025-01-24 01:02:12 UTC
Confirmed that this also fixes forum-fr-13961.doc, tdf31410-3.doc, abi7500-1.doc, and ooo42420-1.doc

Confirmed that tdf85430-1 is still fixed from before.