Bug 164871 - Grid wrongly takes priority over "Exact" or "atLeast 0" spacing
Summary: Grid wrongly takes priority over "Exact" or "atLeast 0" spacing
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: Jonathan Clark
URL:
Whiteboard: target:25.8.0 target:25.2.2
Keywords:
Depends on:
Blocks: Text-Grid
  Show dependency treegraph
 
Reported: 2025-01-27 13:54 UTC by Justin L
Modified: 2025-02-14 12:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
164803_exactHeight.docx: 1 page example where grid of 2 is overridden by exact spacing of 12pt (13.00 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-01-27 13:54 UTC, Justin L
Details
MSO: Various grid and line spacing cases (32.92 KB, application/pdf)
2025-02-10 13:22 UTC, Jonathan Clark
Details
LO: Various grid and line spacing cases (20.12 KB, application/pdf)
2025-02-10 13:23 UTC, Jonathan Clark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2025-01-27 13:54:46 UTC
Created attachment 198785 [details]
164803_exactHeight.docx: 1 page example where grid of 2 is overridden by exact spacing of 12pt

If a paragraph is set to have Exact spacing (or atLeast 0 spacing), then the grid is not supposed to affect it (at least according to MS Word's implementation).

Steps to reproduce.
1.) Open 164803_exactHeight.docx

The document should be only one page long. The paragraphs are set to have exactly 12pt spacing.
Comment 1 Justin L 2025-01-27 14:24:13 UTC
See bug 164803 comment 12 regarding atLeast 0. ooo39057-1.doc is an example of that, and can be found in 164803_more_examples.zip (attachment 198683 [details] from bug 164803 comment 3)

[To see this document grid stuff in MS Word, I had to go into File - Options - Languages and add an editing language (Japanese). (Simply that. Not Enabled keyboard and Not Installed grammar is fine...)

Now in Page Layout - Page Setup dialog I can see a Document Grid tab, and paragraph properties now shows a Snap-to-Grid checkbox.]
Comment 2 Regina Henschel 2025-01-28 11:28:33 UTC
That is the setting "Snap to text grid (if active)" in the alignment tab of the paragraph properties. If it is off, the distances are the same as in Word. So the docx import should set this property to "off".
Comment 3 Jonathan Clark 2025-02-10 13:22:54 UTC
Created attachment 199110 [details]
MSO: Various grid and line spacing cases

PDF exported with Microsoft Word, showing various line spacing options used along with text grid.
Comment 4 Jonathan Clark 2025-02-10 13:23:53 UTC
Created attachment 199111 [details]
LO: Various grid and line spacing cases

Corresponding cases, exported using LibreOffice.
Comment 5 Jonathan Clark 2025-02-10 13:47:59 UTC
Confirming. There are some significant differences in how line spacing is handled in Writer versus Word when combined with text grid.

Single, 1.5x, double, and multiples seem to work the same in both programs.

Writer ignores atLeast and exact when the document/paragraph has grid enabled. The next line is always snapped to the next grid row.

In Word, atLeast 0 disables the extra spacing added by the grid. For atLeast N (where N > row pitch), the following line is positioned at N (i.e. it is not snapped to the next grid row).

In Word, exact spacing also works as expected (always overriding the grid spacing).
Comment 6 Commit Notification 2025-02-12 19:47:20 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "master":

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

tdf#164871 sw: Implemented exact and at-least line spacing for 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-02-12 19:51:55 UTC
Comparing manually, line spacing within paragraphs now matches between Writer and Word when using the exact or at-least spacing types, as discussed previously.

There is still a difference in vertical placement of paragraphs. That difference was preexisting, and doesn't seem related to exact or at-least line spacing.
Comment 8 Commit Notification 2025-02-14 12:45:11 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

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

tdf#164871 sw: Implemented exact and at-least line spacing for grid

It will be available in 25.2.2.

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.