Bug 50068 - Incorrect spacing above paragraph on second column of section
Summary: Incorrect spacing above paragraph on second column of section
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 53304 129304 130504 156064 (view as bug list)
Depends on:
Blocks: Page-Layout-Columns
  Show dependency treegraph
 
Reported: 2012-05-17 17:53 UTC by Ray Lehtiniemi
Modified: 2023-06-26 20:13 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample document to illustrate paragraph spacing at top of column (33.59 KB, application/vnd.oasis.opendocument.text)
2012-05-17 17:53 UTC, Ray Lehtiniemi
Details
An example using default styles, with non-zero spacing above paragraphs (12.29 KB, application/vnd.oasis.opendocument.text)
2015-04-04 16:05 UTC, Mark Bourne
Details
tdf50068_columnSpacingAbove.odt: exaggerated example, 3 scenarios (12.95 KB, application/vnd.oasis.opendocument.text)
2018-12-26 19:26 UTC, Justin L
Details
tdf50068_columnOverflowUpperSpace.odt: if first paragraph padding is honored, then probably shouldn't align column tops, right? (12.33 KB, application/vnd.oasis.opendocument.text)
2018-12-27 09:30 UTC, Justin L
Details
tdf50068_testsuite.zip: how spacing affects column breaks, page breaks, multiple sections, natural paragraph breaks (120.05 KB, application/zip)
2018-12-28 07:28 UTC, Justin L
Details
0001-tdf-50068-partial-fix-sw-spacing-in-text-not-section.patch (3.23 KB, patch)
2018-12-28 09:11 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Lehtiniemi 2012-05-17 17:53:20 UTC
Created attachment 61770 [details]
Sample document to illustrate paragraph spacing at top of column

See top of second column on page 10 of attached document.  I would expect the spacing above the "Heading 1a" paragraph (1914 Translation...) at the top of the second column to be compressed/removed, to match the first column.
Comment 1 Joel Madero 2012-10-03 20:44:04 UTC
I can confirm this problem with LibO 3.6.2.1 on Bodhi Linux. The problem only occurs when you create the Manual Column Break using styles (header 1a), if you just do insert -> manual break it seems to work fine. The behavior is dependent on if you're on the left or right side (column). 

Marking as NEW and prioritizing.
Comment 2 Stephan Zietsman 2013-12-05 20:10:02 UTC
*** Bug 53304 has been marked as a duplicate of this bug. ***
Comment 3 Stephan Zietsman 2013-12-05 20:12:45 UTC
Please see the duplicate Bug 53304 for additional information and steps to reproduce.
Comment 4 Mark Bourne 2015-04-04 16:05:58 UTC
Created attachment 114620 [details]
An example using default styles, with non-zero spacing above paragraphs

I've just come across this in 4.0.4.2 (official build) and 4.4.1.2 (PortableApps build) on Windows Vista.

In case it's any help, it doesn't seem to be caused specifically by heading styles, but by having a non-zero spacing above the paragraph. It looks like the spacing above the paragraph is doubled following a manual column break within a section. Attached is another example, this time using default styles. The default paragraph style has simply been changed to have half a line spacing above each paragraph. The text of the second column, following a manual column break, is offset by an extra half a line compared to the first column.
Comment 5 tommy27 2016-04-16 07:23:31 UTC Comment hidden (obsolete)
Comment 6 Stephan Zietsman 2016-04-18 18:57:53 UTC
This bug is still reproducible (following the steps in 53304).

-- 
LibreOffice 5.1.2.2 10m0(Build:2)
Ubuntu 14.04 (x64)
Comment 7 QA Administrators 2017-05-22 13:23:36 UTC Comment hidden (obsolete, spam)
Comment 8 Mark Bourne 2018-12-23 13:14:54 UTC
Still reproducible with LibreOffice 6.1.3.2 on Linux Mint, using the build from the LibreOffice PPA.

Tested using the document I attached in comment 4, and also by recreating a similar document from scratch (in case an update fixed the issue for newly created documents but preserved the layout of existing documents).

(It seems the last comment from QA requesting testing has been flagged as spam and hidden!)
Comment 9 Justin L 2018-12-26 19:26:00 UTC
Created attachment 147849 [details]
tdf50068_columnSpacingAbove.odt: exaggerated example, 3 scenarios

A big part of this bug is layout flowfrm.cxx's wonky HasParaSpaceAtPages(), which has untouched logic since first import. Sounds very dangerous.
Comment 10 Justin L 2018-12-27 09:30:46 UTC
Created attachment 147853 [details]
tdf50068_columnOverflowUpperSpace.odt: if first paragraph padding is honored, then probably shouldn't align column tops, right?

I haven't figured out why the first column's "upper" space spills over to the next column (and occasionally to the next page). It seems wrong to me because IF the spacing above the starting paragraph is honoured, THEN overflow from the paragraph should start at the top of the column (upper = 0), and not be lined up with the first paragraph (upper = x).

For the previously given example documents, there is a compatibility setting that "fixes" these particular documents.  Turn off Tools - Options - Writer - Compatibility - "Add paragraph and table spacing at tops of pages".

Or alternatively, the user can just zero out the "space above" on the paragraphs that don't line up.
Comment 11 Justin L 2018-12-27 20:04:26 UTC
I'd better walk away from this bug, or else I'll get into deep trouble.

For some reason, the section-frame itself gets the upper value from the first paragraph in sectfrm.cxx   SwTwips nUpper = CalcUpperSpace(); So that is why all of the following columns use that as their "zero" height.

Notes for whoever decides to tackle this:
-HasParaSpaceAtPages is a big loop - moving outward until a condition is satisfied. So it is VERY hard to make a change here that doesn't have side effects.
-make sure you also test against multiple pages because the first page is treated differently ( IsPageFrame() && !GetPrev() ).
-
Comment 12 Justin L 2018-12-28 07:28:59 UTC
Created attachment 147869 [details]
tdf50068_testsuite.zip: how spacing affects column breaks, page breaks, multiple sections, natural paragraph breaks

Finding out what documentation says OUGHT to be happening in the case of DocumentSettingId::PARA_SPACE_MAX_AT_PAGES would be good to know, but no point in wasting Regina's time if it won't be acted on by a competent developer.
Comment 13 Justin L 2018-12-28 09:11:29 UTC
Created attachment 147870 [details]
0001-tdf-50068-partial-fix-sw-spacing-in-text-not-section.patch

For those much braver than I, this might give a good starting point.
Comment 14 Timur 2019-12-10 17:18:24 UTC
*** Bug 129304 has been marked as a duplicate of this bug. ***
Comment 15 Timur 2019-12-10 17:19:28 UTC
Repro 6.5+. Also attachment 156452 [details] from duplicated bug 129304.
Comment 16 Timur 2020-02-07 10:35:48 UTC
*** Bug 130504 has been marked as a duplicate of this bug. ***
Comment 17 David Fritzsch 2021-02-11 20:10:32 UTC
> Libre Office 7 and the bug is ~~still~~ there.

# What's the bug ?
Okay there are some paragraphs of text. Select it and make it 2 columns.
(Toggle Formatting Marks.)
Shift+ctrl+Enter to add a 'Manual Column Break'
Well that 'Manual Column Break' mark is shown on the beginning of the new column (and not at the end of the old one as I would expect) however that is not really a problem.
Till that point everything is fine.
Both text columns are well horizontal aligned 

## Now the layout problem 
starts when I gonna use 'Above Paragraph Spacing' setting.
The bug and unexpected behaviour is that the 'Above Paragraph Spacing' of the first paragraph also effects the spacing of the spacing of the following columns.


## Workaround
Just put a 'dummy paragraph' in the first line of a section with columns by just **hitting enter** once. Set the **'Font Size' to 2pt** and ensure **'Above Paragraph Spacing' is 0 cm**.
Comment 18 Justin L 2023-05-11 16:33:12 UTC
The DOCX related report is bug 154082.
Comment 19 Justin L 2023-06-26 19:44:34 UTC
*** Bug 156064 has been marked as a duplicate of this bug. ***
Comment 20 Animus 2023-06-26 20:13:24 UTC Comment hidden (me-too)