Bug 143106 - DOCX: Images are being duplicated on document reopen
Summary: DOCX: Images are being duplicated on document reopen
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.1.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Images
  Show dependency treegraph
 
Reported: 2021-06-28 14:39 UTC by Mihai Vasiliu
Modified: 2022-01-19 18:09 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
This is a document containing 2 images on the first line. When saving the document, LO Writer creates a copy of the second picture. (14.47 KB, application/zip)
2021-06-28 14:46 UTC, Mihai Vasiliu
Details
Example file (ODT) (19.91 KB, application/vnd.oasis.opendocument.text)
2021-06-29 09:04 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Vasiliu 2021-06-28 14:39:27 UTC
Description:
While placing at least 2 images, anchored as a character, on the same line and assigning them a caption, after saving and reopening the DOCX document, the last image is duplicated with the caption and the frame on the very next line.


Version: 7.1.4.2 (x64) / LibreOffice Community
Build ID: a529a4fab45b75fefc5b6226684193eb000654f6
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: ro-RO (ro_RO); UI: en-US
Calc: CL

Steps to Reproduce:
1. Create a new LO document.
2. Place two images on the same line (make them just about half-row each), separating them with some spaces. Make sure that the image anchor is set As Character.
3. Insert a Caption for each one. (This will create a frame for each one.)
4. Save the document as DOCX and close.
5. Reopen the document and notice that the second picture is duplicated under the first one, copying the frame and the Figure 2 designator.

Actual Results:
After reopening the document, the second picture is duplicated under the first picture.

Expected Results:
There must be no change to the document.


Reproducible: Always


User Profile Reset: No



Additional Info:
I can always reproduce this behaviour if the images have captions (and frames) and if the images occupy about half of the line each one.
It reproduces only when saving the document as DOCX.
Comment 1 Mihai Vasiliu 2021-06-28 14:46:02 UTC
Created attachment 173248 [details]
This is a document containing 2 images on the first line. When saving the document, LO Writer creates a copy of the second picture.
Comment 2 Mihai Vasiliu 2021-06-28 14:48:13 UTC
Further information: It seems that LO Writer duplicates the images on SAVING as DOCX and closing, as if I open the document in Microsoft Word, there are already 3 pictures there instead of only 2.

If you continue to "Save As..." the document, it will duplicate the picture even more 2 times, 3 times etc.
Comment 3 Telesto 2021-06-29 09:04:02 UTC
Created attachment 173264 [details]
Example file (ODT)

Based on the source. Deleted 1 image frame saved to ODT. If you export to DOCX you get additional frame

Confirm
Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: c38d0d501f5eca648bdf0fd2914b57e06f505f7e
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 4 Telesto 2021-06-29 09:09:25 UTC
No repro with
Version: 7.1.0.0.beta1+ (x64)
Build ID: f9fab4203c1aa0b9a3f27ce2713b6d5addc7df19
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: nl-NL
Calc: CL
Comment 5 NISZ LibreOffice Team 2021-06-29 13:28:13 UTC
Bibisected with win64-7.2 to:

https://git.libreoffice.org/core/+/3eced2d52415abeac266804ab682bee022322a19

author	Michael Stahl <michael.stahl@allotropia.de>	Wed Mar 10 11:26:07 2021 +0100
committer	Michael Stahl <michael.stahl@allotropia.de>	Wed Mar 10 16:55:05 2021 +0100

sw: DOCX export: put fly before fieldmark start into its own run

Adding CC to: Michael Stahl
Comment 6 Commit Notification 2022-01-13 18:10:18 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#143039 tdf#143106 sw: DOCX export: don't export duplicate flys

It will be available in 7.4.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 2022-01-15 10:30:16 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

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

tdf#143039 tdf#143106 sw: DOCX export: don't export duplicate flys

It will be available in 7.3.1.

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 Timur 2022-01-17 14:01:53 UTC
OK now when reoped in LO and MSO.
I guess this should be marked as Fixed. 
Thanks Michael.
Comment 9 BogdanB 2022-01-19 18:09:13 UTC
Verified with
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 2761545769ef564b14fc8cd854a35c42bc269f02
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded