Bug 158826 - FILEOPEN RTF Floating table with image creates unexpected page break
Summary: FILEOPEN RTF Floating table with image creates unexpected page break
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 beta1+
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:24.8.0 target:24.2.0.2 target:...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: RTF-Floatingtable
  Show dependency treegraph
 
Reported: 2023-12-22 08:30 UTC by Gabor Kelemen (allotropia)
Modified: 2024-02-12 16:35 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word 2016 (329.98 KB, application/msword)
2023-12-22 08:30 UTC, Gabor Kelemen (allotropia)
Details
The example file in Word 2016 and Writer (87.95 KB, image/png)
2023-12-22 08:31 UTC, Gabor Kelemen (allotropia)
Details
floating-table_min.rtf: minimized version of attachment_191557 (391 bytes, application/rtf)
2023-12-27 22:18 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-12-22 08:30:30 UTC
Created attachment 191557 [details]
Example file from Word 2016

While looking at attachment 103717 [details] of bug 81942 I noticed that there is now an empty page in the beginning of the document.

1. Open attached file (minimized from attachment 103717 [details]) 
-> 2 pages instead of one

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 2eb428a8890dda29fbdc8b639fc1377080fab59f
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: threaded

Not reproducible in bibisect-win-24.2 repo, only in the nightly. Does not happen, if the table is made non-floating in Word.
Comment 1 Gabor Kelemen (allotropia) 2023-12-22 08:31:23 UTC
Created attachment 191558 [details]
The example file in Word 2016 and Writer

Don't worry about the table itself falling apart, that's bug 118828
Comment 2 raal 2023-12-27 19:54:40 UTC
I can confirm with 24.2
Comment 3 raal 2023-12-27 19:59:39 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-24.2.
Adding Cc: to Justin Luth ; Could you possibly take a look at this one?
Thanks
 5f1178b545f19fea22f7d3101d821c335964edbe is the first bad commit
commit 5f1178b545f19fea22f7d3101d821c335964edbe
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Tue Dec 19 17:03:43 2023 +0100

    source 7abb319821e641599f92e5f4ad2d7c0e377851fa

160984: tdf#158586 RTF writerfilter: substitute hasProperties for inFrame | https://gerrit.libreoffice.org/c/core/+/160984
Comment 4 Justin L 2023-12-27 22:18:58 UTC
Created attachment 191606 [details]
floating-table_min.rtf: minimized version of attachment_191557

Ahh, RTF. No good deed goes unpunished.
This is related to the \pagebb command (break page before paragraph). Simply removing that from both examples "fixes" the problem.

As I minimized the document, it really seemed to depend on several unrelated factors like having a shape defined etc. Prior to my fix, this minimized document lost the floating table. So I think my patch is fine, but there are just a TON of RTF bugs that will float to the surface. I assume it previously just "got lost" as the page break got applied to paragraph properties that were never applied as we jump from frame to shape to {\cell}.

This \pagebb is defined first thing - before any paragraph etc. Therefore it probably should just be ignored.
Comment 5 Justin L 2023-12-27 22:41:51 UTC
(In reply to Justin L from comment #4)
I assume it previously just "got lost" 
Nope - the page break in floating-table.rtf is tied to the "c" paragraph (which ought to be in the table). After my patch, there is an extra paragraph ahead of that, so now the page break "exhibits" itself.
Comment 6 Commit Notification 2023-12-28 21:52:11 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4399bccc5ee5a3fa69a8818e7ae265c144d33d64

tdf#158826 rtfimport: ignore page break before document starts

It will be available in 24.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 Commit Notification 2023-12-29 02:44:38 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/8d37b8e6430715860934ccaec8c0d1b448ac4d8c

tdf#158826 rtfimport: ignore page break before document starts

It will be available in 24.2.0.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.
Comment 8 Commit Notification 2024-02-12 16:35:39 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

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

tdf#158826 rtfimport: ignore page break before document starts

It will be available in 7.6.6.

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.