Bug 118535 - FILESAVE DOCX Writer saves images anchored to header/footer multiple times
Summary: FILESAVE DOCX Writer saves images anchored to header/footer multiple times
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Dániel Arató (NISZ)
Whiteboard: target:7.2.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Images
  Show dependency treegraph
Reported: 2018-07-04 11:00 UTC by Gabor Kelemen (allotropia)
Modified: 2021-04-07 12:02 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:

Example file from Writer (203.40 KB, application/vnd.oasis.opendocument.text)
2018-07-04 11:00 UTC, Gabor Kelemen (allotropia)
Same file saved as docx from LO master (249.09 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-07-04 11:03 UTC, Gabor Kelemen (allotropia)
Content of the files - docx has two instances of the same image (38.18 KB, image/png)
2018-07-04 11:06 UTC, Gabor Kelemen (allotropia)

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2018-07-04 11:00:17 UTC
Created attachment 143304 [details]
Example file from Writer

Writer saves copies of images belonging to different header/footer styles only once to odt, but multiple times to docx, increasing file size unnecessarily. Word saves such images only once too.

To reproduce:
1, Create a custom page style in Writer
2, Insert an image into the default page header, make sure to anchor it to the paragraph in the header
3, Insert a page break, set the custom page style to the new page
4, Insert the *same* image into the second pages header, make sure to anchor it to the paragraph in the header
5, Save the document to odt and docx.

If you rename the files to zip and unpack them, you should see one instance of the image in the odt's Pictures directory, and two instances of the docx's word\media directory.

Expected results:
Docx export should contain the image only once.

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-04 11:03:20 UTC
Created attachment 143305 [details]
Same file saved as docx from LO master
Comment 2 Gabor Kelemen (allotropia) 2018-07-04 11:06:01 UTC
Created attachment 143306 [details]
Content of the files - docx has two instances of the same image

The original user document we got contained 20 header/footer styles with this image, so it grew from ~250kB to ~2.5 Mb after saving from LO.
Comment 3 Buovjaga 2018-07-15 15:48:54 UTC
Repro. Keeping severity as normal as the size increase can indeed be quite nasty.

Arch Linux 64-bit
Build ID: 860a9daf2b45942a4b10ff22d36aa3fe29be19f4
CPU threads: 8; OS: Linux 4.17; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group threaded
Built on July 14th 2018

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-
Comment 4 QA Administrators 2019-10-12 02:43:30 UTC Comment hidden (obsolete)
Comment 5 NISZ LibreOffice Team 2019-11-06 15:19:02 UTC
Still happens with:

Version: (x86)
Build ID: 80109586e6cb6d3e2e0a53a9079c3125ec9b8368
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: GL; VCL: win; 
Locale: hu-HU (hu_HU); UI-Language: en-US
Calc: CL
Comment 6 Commit Notification 2021-03-26 12:09:01 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":


tdf#118535 DOCX export: save header image once

It will be available in 7.2.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:

Affected users are encouraged to test the fix and report feedback.
Comment 7 NISZ LibreOffice Team 2021-04-07 12:02:35 UTC
Verified in: 

Version: (x64) / LibreOffice Community
Build ID: ea4fb1559f7b99a0bfaf18f26cb3b6972c9cde1c
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded