Bug 118701 - FILESAVE DOCX Images anchored as characters before page breaks with page style changes are moved to the next page
Summary: FILESAVE DOCX Images anchored as characters before page breaks with page styl...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Attila Bakos (NISZ)
URL:
Whiteboard: target:7.1.0
Keywords: filter:docx
: 95372 (view as bug list)
Depends on:
Blocks: DOCX-Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2018-07-11 15:47 UTC by Gabor Kelemen (allotropia)
Modified: 2022-07-13 21:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
The original file saved in ODF format. (21.69 KB, application/vnd.oasis.opendocument.text)
2018-07-11 15:47 UTC, Gabor Kelemen (allotropia)
Details
The OOXML export to demonstrate the bug. (24.64 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-07-11 15:48 UTC, Gabor Kelemen (allotropia)
Details
A screenshot showing the ODF and OOXML version of the same document. (72.72 KB, image/png)
2018-07-11 15:48 UTC, Gabor Kelemen (allotropia)
Details
The_Page_Break_Position_In_Word (11.56 KB, image/png)
2020-02-17 08:17 UTC, Attila Bakos (NISZ)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2018-07-11 15:47:44 UTC
Created attachment 143470 [details]
The original file saved in ODF format.

If an image anchored as character is the last character in a non-first paragraph before a page break with page style change, the image becomes the first character on the next page after saving the document as DOCX and reopening it. This can also cause to separate the header text from its corresponding numbering.


Steps to reproduce:

1.	Create a new document in LibreOffice Writer.
2.	Type in some random text in a paragraph, and press Enter to create a new paragraph (this is mandatory to reproduce the bug).
3.	Insert an image in the second paragraph, and anchor it as character.
4.	Click on Insert – Manual Break, select Page break and a new style. Leaving the Style on the [none] option won't trigger the bug, but even Default style will do in this case.
5.	Type some random text on the second page. If you turn on numbering for this line, you will see how the image will separate the text from its corresponding numbering (it doesn't even have to be header style paragraph).
6.	Save the document as DOCX, and reload it.

Actual results:
The image that was originally the last character on a page moves to the next page to become the first character.

Expected results:
The image should stay where it originally was.

LibreOffice details:
Version: 6.2.0.0.alpha0+
Build ID: bb1d5780226bb1b9156580972eea9aa849178742
CPU threads: 1; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-07-03_05:56:48
Locale: hu-HU (hu_HU); Calc: group threaded
Comment 1 Gabor Kelemen (allotropia) 2018-07-11 15:48:10 UTC
Created attachment 143471 [details]
The OOXML export to demonstrate the bug.
Comment 2 Gabor Kelemen (allotropia) 2018-07-11 15:48:37 UTC
Created attachment 143472 [details]
A screenshot showing the ODF and OOXML version of the same document.
Comment 3 Gabor Kelemen (allotropia) 2018-07-11 15:49:05 UTC
This was found by a member of my team.
Comment 4 Xisco Faulí 2018-07-12 15:15:23 UTC
Also reproduced in

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.10; Render: default; 

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 5 QA Administrators 2019-10-12 02:44:11 UTC Comment hidden (obsolete)
Comment 6 Attila Bakos (NISZ) 2020-02-17 08:17:26 UTC
Created attachment 157935 [details]
The_Page_Break_Position_In_Word

I don' t think this is an export problem: rather an import see this attachment. Like in Bug 112342 after export the image and the newpage symbol in the same line without a space/enter so on opening the same happens like in Bug 112342, the image and the the newpage position changes place with each other. If I place an enter an split the newline and image parts of the line it will be fine.
Comment 7 Commit Notification 2020-07-10 12:46:39 UTC
Bakos Attila committed a patch related to this issue.
It has been pushed to "master":

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

tdf#118701 DOCX import: fix image position on page break

It will be available in 7.1.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 8 Gabor Kelemen (allotropia) 2022-07-13 21:58:10 UTC
*** Bug 95372 has been marked as a duplicate of this bug. ***