Bug 164787 - Unexpected top margin for paragraph at the top of non-first pages from DOCX
Summary: Unexpected top margin for paragraph at the top of non-first pages from DOCX
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.0.1 rc
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://vmiklos.hu/blog/sw-ignore-mar...
Whiteboard:
Keywords:
Depends on: 160952
Blocks: DOCX-Page
  Show dependency treegraph
 
Reported: 2025-01-21 15:44 UTC by Piotr Osada
Modified: 2025-01-22 07:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Unexpected space above paragraph is added (221.60 KB, image/png)
2025-01-21 15:44 UTC, Piotr Osada
Details
Original 'minimal reproducer' by Miklos Vajna (14.55 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-01-21 15:47 UTC, Piotr Osada
Details
'REPRODUCER' saved in LO25.2.0.2 (9.79 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-01-21 15:48 UTC, Piotr Osada
Details
'REPRODUCER' saved in Word 2412 (2024) (14.85 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-01-21 15:49 UTC, Piotr Osada
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Osada 2025-01-21 15:44:10 UTC
Created attachment 198649 [details]
Unexpected space above paragraph is added

+++ This bug was initially created as a clone of Bug #160952 +++

It looks like an introduction of *SwFrame::IsCollapseUpper()* function from the commit 6200d89b905d51776ff4f3c8a84f338655ffaa7f is a workaround for 'purging' top margin, and not for collapsing top margin.

Observations:
+--------------------------------------------------------------+
|          <TOP MARGIN>---<PARAGRAPH> SPACING BEHAVIOR         |
+--------------+-----------------------------------------------+
|              |                    Open by                    |
+--------------+---------------+---------------+---------------+
| FILE         |      Word     |       LO      |       LO      |
|              |               |    7.6.5.2    |    25.2.0.2   |
+--------------+---------------+---------------+---------------+
| scratch.docx | NO additional | THERE IS      | THERE IS      |
|              | space         | additional    |               |
|              |               | space         | additional    |
|              |               |               | space         |
|              | guess:        | guess: LO     |               |
|              | ignored/      | can't ignore  | guess: LO     |
|              | collapsed     | this          | can't ignore  |
|              |               |               | this          |
+--------------+---------------+---------------+---------------+
| scratch.docx | NO additional | NO additional | NO additional |
| saved in     | space         | space         | space         |
| LO25.2.0.2   |               |               |               |
|              | guess:        | guess:        | guess:        |
|              | margin value  | margin value  | margin value  |
|              | is set to 0   | is set to 0   | is set to 0   |
+--------------+---------------+---------------+---------------+
| scratch.docx | NO additional | THERE IS      | THERE IS      |
| saved in     | space         | additional    | additional    |
| Word 2412    |               | space         | space         |
|              |               |               |               |
|              | guess:        | guess: LO     |               |
|              | ignored/      | can't ignore  | guess: LO     |
|              | collapsed     | this          | can't ignore  |
|              |               |               | this          |
+--------------+---------------+---------------+---------------+
|         https://www.tablesgenerator.com/text_tables#         |
+--------------+---------------+---------------+---------------+

attachment 193984 [details]
is a DOCX file claimed to be created in Word 2013
-- 1) only existing paragraph on first page has 0 pt paragraph-spacing before
-- 2) only existing paragraph on second page has 120 pt paragraph-spacing before


Step to reproduce the problem:

1) Open the attached DOCX file (attachment 193984 [details]) in LO25.2.0.2 or earlier.

Expected result: no top margin is displayed, like in Word.

Actual result: 4.23 cm top margin is displayed.
Comment 1 Piotr Osada 2025-01-21 15:47:07 UTC
Created attachment 198650 [details]
Original 'minimal reproducer' by Miklos Vajna
Comment 2 Piotr Osada 2025-01-21 15:48:28 UTC
Created attachment 198651 [details]
'REPRODUCER' saved in LO25.2.0.2
Comment 3 Piotr Osada 2025-01-21 15:49:32 UTC
Created attachment 198652 [details]
'REPRODUCER' saved in Word 2412 (2024)
Comment 4 Piotr Osada 2025-01-21 15:54:09 UTC
Mentioned software in comment 0:

Microsoft® Word dla Microsoft 365 MSO (wersja 2412 kompilacji 16.0.18324.20092) 64-bitowa 

Version: 7.6.5.2 (X86_64) / LibreOffice Community
Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b
CPU threads: 8; OS: Windows 10.0 Build 26100; UI render: Skia/Vulkan; VCL: win
Locale: pl-PL (pl_PL); UI: en-US
Calc: CL threaded

Version: 25.2.0.2 (X86_64) / LibreOffice Community
Build ID: 62af784cc06624122f17ee71c7cf13d906cbaed0
CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: pl-PL (pl_PL); UI: en-US
Calc: CL threaded
Comment 5 Piotr Osada 2025-01-21 15:57:42 UTC
How attachment 193984 [details] DOCX was edited so that it have paragraph-spacing, but it is skipped when displaying?
Comment 6 Piotr Osada 2025-01-21 15:59:12 UTC
BTW 25.2.0.2 RC did not exist at the moment of filing this ticket.
Comment 7 Miklos Vajna 2025-01-22 07:41:09 UTC
Thanks for filing the new bug. Let's reset assignee back to default till I or somebody else has the time to investigate this.