Download it now!
Bug 65836 - FILESAVE: DOCX exporting picture inside canvas corrupts DOCX
Summary: FILESAVE: DOCX exporting picture inside canvas corrupts DOCX
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: All All
: high major
Assignee: Nikhil Walvekar
URL:
Whiteboard: BSA target:4.3.0 target:4.2.7
Keywords:
: 69607 70454 (view as bug list)
Depends on:
Blocks: mab4.0
  Show dependency treegraph
 
Reported: 2013-06-16 16:23 UTC by Adam CloudOn
Modified: 2014-09-17 10:05 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
DOCX containing picture inside canvas (24.09 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-06-16 16:23 UTC, Adam CloudOn
Details
save as DOCX again and open with LO3.6.7.2 (60.71 KB, image/png)
2013-07-19 02:50 UTC, Kevin Suo
Details
Corrupted DOCX picture inside canvas exported by LO (4.41 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-09-20 15:45 UTC, Adam CloudOn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam CloudOn 2013-06-16 16:23:57 UTC
Created attachment 80918 [details]
DOCX containing picture inside canvas

Problem description: 
Opened the attached DOCX in LO (the DOCX contains a picture inside a canvas). When saving as a NEW.DOCX and opening it in Word - the DOCX is corrupted. When Word tries to recover the file - it recovers the picture, but not in a canvas. Also there are a lot of rectangles.

Steps to reproduce:
1. Open attached DOCX in LO.
2. Save as NEW.DOCX
3. Open NEW.DOCX in Word
4. Word says file is corrupt

Current behavior:
Saving to a new DOCX creates a corrupted file.

Expected behavior:
LO should export to a new DOCX the picture inside canvas (with no rectangles)
              
Operating System: Ubuntu
Version: 4.2.0.0.alpha0+ Master
Comment 1 Joel Madero 2013-06-20 18:51:35 UTC
Thank you for reporting this issue! I have been able to confirm the issue on:
Version: 4.2.0.0.alpha0+Build ID: b0a1666f756aa5f5315366eca9d7d02ddd55d2b
Date:   Tue May 28 08:51:01 2013 +0300 
Platform: Bodhi Linux 2.2 x64

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
As I've been able to confirm this problem I am marking as:

New (confirmed)
Major - loss of data or severe corruption of data
High

Blocks: MAB 4

Note: I think that this relates to quite a few other picture docx reports and could be a duplicate of another one but I can't seem to find it. 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage and join us on freenode at #libreoffice-qa

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 2 Joel Madero 2013-06-20 18:53:55 UTC
Changing version to 4.0.3 as I see the same issue. Version is the oldest version that we see the problem.

In older versions I see complete loss of data, here I just see scrambled weird results (as described in description) - either way, major bug
Comment 3 untraceable 2013-07-05 14:44:48 UTC
Occurs also with my installation of

Version: 4.1.0.1 on Windows 7
Build ID: 1b3956717a60d6ac35b133d7b0a0f5eb55e9155

Remarkably, if you look into the saved new.docx as zip archive (rename *.docx to *.zip) you find an empty, 0 bytes image in /word/media/ without any extension, whereas in the original file it was a wmf file with the same name.

I hope this helps tracking the bug.

It might have (remotely) something to do with Bug 52226, but I rather guess not.
Comment 4 Adam CloudOn 2013-07-10 12:55:32 UTC
Does not show rectangles any more (still corrupt).
Now when Word recovers the file - it contains a simple empty rectangle.
Comment 5 Kevin Suo 2013-07-19 02:50:09 UTC
Created attachment 82646 [details]
save as DOCX again and open with LO3.6.7.2

Confirm in LO3.6.7.2.

With LibreOffice 3.6.7.2, when save the sample file as DOCX (2007-2010), and open the new file with LibreOffice, the second picture is lost.
Comment 6 Adam CloudOn 2013-09-20 15:45:06 UTC
Created attachment 86196 [details]
Corrupted DOCX picture inside canvas exported by LO
Comment 7 Jacobo Aragunde Pérez 2013-10-15 07:30:56 UTC
*** Bug 70454 has been marked as a duplicate of this bug. ***
Comment 8 Sushil Shinde 2013-10-22 06:36:22 UTC
https://gerrit.libreoffice.org/#/c/6369/1.

In this fix, it fixes few issue related to this bug-
 1) <v:imagedata> was getting replaced by <v:fill > in w:pict/v:shape.
 2) Handling of image formats like .jpef,.gif etc. (earlier it was handling only .png file in vmlexport).

In attached file, It contains .wmf image. I have not found handling of wmf image in code yet. I can see there is a flag for wmf image in DrawingML::WriteImage i.e GFX_LINK_TYPE_NATIVE_WMF. 

I am working export part for wmf image.
Comment 9 tommy27 2013-11-04 21:45:53 UTC
picture lost after resaving as docx in 4.1.2.3 under Win7 64bit.
Comment 10 tommy27 2013-11-04 21:48:11 UTC
Bug 36799 seems very similar to this.
Comment 11 Adam CloudOn 2013-11-10 10:15:55 UTC
(In reply to comment #10)
> Bug 36799 seems very similar to this.

Hi Tommy, not sure how Bug 36799 is related. Can you explain why you think so?

Also - this bug report is only meant to solve the 'corruption' problem with the DOCX after exporting it from LibreOffice.

For the problem that the image is being lost - a new bug needs to be opened.
Comment 12 tommy27 2013-11-11 06:55:20 UTC
sorry I think I have pasted the wrong bug number.

the bug I was talking about is Bug 70501
Comment 13 Nikhil Walvekar 2013-12-02 07:19:23 UTC

*** This bug has been marked as a duplicate of bug 69607 ***
Comment 14 Kevin Suo 2013-12-02 07:47:47 UTC
(In reply to comment #13)
> 
> *** This bug has been marked as a duplicate of bug 69607 ***

This bug is earlier than bug 69607, and is on the MAB4.0 list, so is it appropriate to be marked as dup of 69607?
Comment 15 Mihkel Tõnnov 2013-12-02 11:32:23 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > 
> > *** This bug has been marked as a duplicate of bug 69607 ***
> 
> This bug is earlier than bug 69607, and is on the MAB4.0 list, so is it
> appropriate to be marked as dup of 69607?

I agree. Reopening and marking bug 69607 as a dupe of this bug instead.
Comment 16 Mihkel Tõnnov 2013-12-02 11:32:41 UTC
*** Bug 69607 has been marked as a duplicate of this bug. ***
Comment 17 Nikhil Walvekar 2013-12-11 07:22:53 UTC
Patch https://gerrit.libreoffice.org/#/c/6849/2 for review
Comment 18 Commit Notification 2013-12-13 11:50:46 UTC
Nikhil Walvekar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8fe352be80ff69552f622f3c7a6a6f269912ab71

fdo#65836 Do not compress WMF / EMF file incase of OOXML export



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2014-09-17 10:05:48 UTC
Nikhil Walvekar committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6f87913d843a97963703721506495bd57af36461&h=libreoffice-4-2

fdo#65836 bnc#621241 Do not compress WMF / EMF file incase of OOXML export


It will be available in LibreOffice 4.2.7.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.