Bug 146175 - "Keep with next paragraph" does not work when image is anchored to following paragraph
Summary: "Keep with next paragraph" does not work when image is anchored to following ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Anchor-and-Text-Wrap Paragraph
  Show dependency treegraph
Reported: 2021-12-11 11:16 UTC by Egil Sølvberg
Modified: 2023-11-06 11:49 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

Example odt-file (9.57 MB, application/vnd.oasis.opendocument.text)
2021-12-11 11:19 UTC, Egil Sølvberg
Writer file showing problem with "Keep with next paragraph" setting (142.40 KB, application/vnd.oasis.opendocument.text)
2023-11-06 11:49 UTC, R. Green

Note You need to log in before you can comment on or make changes to this bug.
Description Egil Sølvberg 2021-12-11 11:16:36 UTC
style:paragraph-properties fo:keep-with-next="always" does not work if next paragraph (an image) covers less than remaining page but more than remaining space down to bottom margin. The current paragraph is drawn on the current page, but the next paragraphp is drawn on the next page.

Actual Results:
Example file attached

Expected Results:
As stated in Description

Reproducible: Always

User Profile Reset: No

Additional Info:
Example file attached
Comment 1 Egil Sølvberg 2021-12-11 11:19:02 UTC
Created attachment 176862 [details]
Example odt-file
Comment 2 Dieter 2021-12-27 11:29:09 UTC
I confirm it with

Version: (x64) / LibreOffice Community
Build ID: 9c95415de877af1430ab5b7123e11dedd0ea622c
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

expected result
Paragraph before image should be on second page.

Additional informations
- If you open paragraph dialog of paragraph before image, deselect and select "keep with next paragraph option" it works (paragraph jumps to second page).
- If you add or delete a character or delete a tabstop in paragraph before image, paragraph also jumps to second page.
- If you change anchor from "to parapgraph" to "to character" paragraph also jumps to second page.
Comment 3 R. Green 2023-11-06 11:49:40 UTC
Created attachment 190676 [details]
Writer file showing problem with "Keep with next paragraph" setting

Version: (X86_64) / LibreOffice Community
Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6
CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Calc: threaded

I have an example of, what looks like, the same thing.

1. Open the attached writer file.
2. Notice that on page 2 the paragraph and its associated image (anchored to character) has become split from its heading (Heading 3) even though Paragraph style >Text flow > "Keep with next paragraph" is checked for the heading.

EXPECTED RESULT: The heading should have moved to the next page with the following paragraph (and its image).

This a common problem in documents such as user manuals where there are lots of headings and images.