Bug Hunting Session
Bug 51550 - FILESAVE as .docx looses embedded OLE objects
Summary: FILESAVE as .docx looses embedded OLE objects
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.3 release
Hardware: Other All
: high critical
Assignee: Miklos Vajna
URL:
Whiteboard: target:4.0.0 target:3.6.4
Keywords:
Depends on:
Blocks: mab4.2
  Show dependency treegraph
 
Reported: 2012-06-29 02:50 UTC by Sebastian@SSpaeth.de
Modified: 2014-11-03 14:07 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Original ODT file (41.07 KB, application/vnd.oasis.opendocument.text)
2012-06-29 02:50 UTC, Sebastian@SSpaeth.de
Details
Saved by LibO 3.5.3.2, objects are lost in WinWord (6.31 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2012-06-29 02:50 UTC, Sebastian@SSpaeth.de
Details
Saved by LibO 3.5.3.2, objects are fine in WinWord 2010 (33.50 KB, application/msword)
2012-06-29 02:51 UTC, Sebastian@SSpaeth.de
Details
Saved by LibO 4.2.3.3, second object lost in LibO (66.48 KB, image/png)
2014-04-30 20:06 UTC, tommy27
Details
Saved by LibO 4.3.1.2, both OLE objects saved as images (13.00 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2014-09-30 20:44 UTC, tommy27
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian@SSpaeth.de 2012-06-29 02:50:03 UTC
Created attachment 63594 [details]
Original ODT file

LibO 3.5.3.2, Ubuntu Linux amd64

The attached .odt file contains 2 embedded spreadsheets.

1) Saving the file, as .docx, Windows Office 2010 fails to display the objects (they are simply gone)

2) Saving the .odt as .doc it opens just fine in Office 2010, showing the tables as "Excel 97" objects.

3) Opening the .odt directly in WinWord simply displays a struck out box  (big fat red cross) where the table object would be.

Not sure, if we fail to produce valid .docx, or if WinWord fails here....
Comment 1 Sebastian@SSpaeth.de 2012-06-29 02:50:44 UTC
Created attachment 63595 [details]
Saved by LibO 3.5.3.2, objects are lost in WinWord
Comment 2 Sebastian@SSpaeth.de 2012-06-29 02:51:15 UTC
Created attachment 63596 [details]
Saved by LibO 3.5.3.2, objects are fine in WinWord 2010
Comment 3 Sebastian@SSpaeth.de 2012-06-29 07:32:02 UTC
(In reply to comment #1)
> Created attachment 63595 [details]
> Saved by LibO 3.5.3.2, objects are lost in WinWord

Notice how the saved .docx shrinks in size (41k vs 6k vs 34k), compared to both the original .odt and the saved .doc file. So it seems, the objects are really not included in the save-as-docx file.
Comment 4 Sebastian@SSpaeth.de 2012-06-30 02:32:16 UTC
I can confirm that saving the original .odt as .docx under LibO  3.5.4.2 also leads to the embedded objects missing in the saved file.
Comment 5 Sebastian@SSpaeth.de 2012-07-02 03:29:48 UTC
Another update, the embedded tables are missing in the .docx file even, when saving them with current Master (Version 3.7.0.0.alpha0+ (Build ID: 616ad0b))
Comment 6 Sebastian@SSpaeth.de 2012-07-04 03:09:20 UTC
This bug is about failure to save embedded spreadsheets/charts in the .docx file (object physically missing from the file).

Related(?) to this, might be a failure to load them if saved by Excel/WinWord filed in bug 46546.
Comment 7 Björn Michaelsen 2012-07-04 03:10:32 UTC
setting back version to 3.5.3 (see rules about version field) and confirming (on 3.5.5~rc2 linux)
Comment 8 Rainer Bielefeld Retired 2012-07-04 04:12:37 UTC
[Reproducible] with reporter's and own sample and "LibreOffice  3.5.5.3.  German UI/Locale [Build-ID: 7122e39-92ed229-498d286-15e43b4-d70da21] on German WIN7 Home Premium (64bit) 

All OLE objects except Math Object will be lost after having saved a native .odt as .docx

We have several such "loss when save from/as .docx" reports with may be overlapping roots.

Still the same with parallel installation of Master "LOdev " 3.7.0.0.alpha0+   - WIN7 Home Premium (64bit) ENGLISH UI [Build ID: 3985521]" (tinderbox: W2008R2@16-minimal_build, pull time 2012-06-24)

I did not check where problem started.


@Michael:
Please set Status to ASSIGNED and add yourself to "Assigned To" if you accept this Bug
Comment 9 Sebastian@SSpaeth.de 2012-08-21 14:17:00 UTC
Adding Cedric to CC as suggested by mmeeks.
Comment 10 Timur 2012-11-05 11:10:33 UTC
Please raise from Medium and Normal to something higher, this is data loss. 
Please add an explanation for Importance fields at https://bugs.freedesktop.org/page.cgi?id=fields.html#importance.
Comment 11 Miklos Vajna 2012-11-08 17:36:49 UTC
OK, I had a look at this, seems for DOCX we never wrote replacement images for OLE object in the past, so this is an issue for master as well. This is something that works in RTF, though.

I have a local patch to get this working, I'll try to clean it up soon and get it into master.
Comment 12 Not Assigned 2012-11-09 09:59:24 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

fdo#51550 fix DOCX export dataloss on non-math/chart OLE 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 13 Miklos Vajna 2012-11-09 13:31:11 UTC
Resolved in master, -3-6 review: https://gerrit.libreoffice.org/1017
Comment 14 Not Assigned 2012-11-10 09:02:15 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fc3f771c1f5fed267298c851e94bef9557278b5b&g=libreoffice-3-6

fdo#51550 fix DOCX export dataloss on non-math/chart OLE export


It will be available in LibreOffice 3.6.4.

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 15 Rainer Bielefeld Retired 2012-12-28 08:01:44 UTC
Already [Reproducible] with Server Installation of "LibreOffice 3.3.3  German UI/Locale [OOO330m19 (Build:301) tag libreoffice-3.3.3.1] on German WIN7 Home Premium (64bit)
Comment 16 Jacobo Aragunde Pérez 2014-03-05 09:56:20 UTC
Still reproducible in master (4.3), AFAIK it was never completely fixed for embedded spreadsheets as originally reported, we only wrote an image preview instead of the sheet.

I've been working on the docx exporter to support the roundtrip of embedded sheets in docx documents. In theory, I should have been able to fix this bug with some little modifications, but I got stuck and now I don't have much time for this.

Part of the relevant code is at DocxExport::WriteOLEObject, where we fail at getting an input stream to the embedded sheet if the original document is an .odt; fixing that would save the embedded sheet into the exported document.

You will need one more thing for Word to detect the object as an embedded sheet: at DocxAttributeOutput::WriteOLE you should check if sProgID is empty, and if it is, you should manually detect the type of the document in the object and set the proper value to that variable. In the case of an embedded .ods, the value would be "Excel.OpenDocumentSpreadsheet.12".
Comment 17 Michael Meeks 2014-03-05 10:08:24 UTC
moving to a more modern MAB then =) thanks Jacobo !
Comment 18 tommy27 2014-04-30 20:06:45 UTC
Created attachment 98263 [details]
Saved by LibO 4.2.3.3, second object lost in LibO

retested test case under Win7x64 using 3.5.0 and 4.2.3 final releases

in 3.5.0 all the 2 objects were lost after saving as .docx and reloading in LibO

now first object persists in 4.2.3 while second is still lost

so situation improved but bug not still 100% fixed
Comment 19 tommy27 2014-05-01 08:25:24 UTC
4.1.x reached end of life.
moving this still reproducible bug to mab4.2 list.
Comment 20 Sebastian@SSpaeth.de 2014-05-24 15:33:46 UTC
Bug reporter here. I can confirm that the second embedded table is still being completly lost (without replacement image or anything) when saving to .docx.

I object to call the first embedded spreadsheet being "fixed" though, it is replaced by a graphic showing the spreadsheet, which is something very different from the embedded spreadsheet.
Comment 21 tommy27 2014-09-30 20:44:32 UTC
Created attachment 107154 [details]
Saved by LibO 4.3.1.2, both OLE objects saved as images

@Sebastian
I retested with LibO 4.3.1.2 and recent 4.4.0.0 master

now the second table is not lost but, as you correctly pointed out regarding the first one, both OLE objects are converted into images when saved in .docx rather the being embedded in the file like in the source .odt

so, another improvement from previous releases, but still not a definitive fix.
Comment 22 Joel Madero 2014-11-02 16:02:41 UTC
I suggest creating two new bug reports to describe the two separate behaviors. As described the original bug was looked at, and something was done. If you're unhappy with what is done, please create a new bug report to point that out. You can put this bug in the SEE area of the new bug reports. Also because there are two different behaviors, it's better to separate the bugs into two reports.

Moving back to FIXED. Please don't reopened it.