Bug 89317 - Table corrupted when saved as doc
Summary: Table corrupted when saved as doc
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: Other All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:5.3.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2015-02-11 19:31 UTC by Zeki Bildirici
Modified: 2017-05-18 19:14 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Original ODT file (138.57 KB, application/vnd.oasis.opendocument.text)
2015-02-11 19:31 UTC, Zeki Bildirici
Details
Corrupted doc version (126.00 KB, application/msword)
2015-02-11 19:32 UTC, Zeki Bildirici
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zeki Bildirici 2015-02-11 19:31:34 UTC
Created attachment 113325 [details]
Original ODT file

Hi,

When saving the attached document as doc, the first table block is corrupted when opening with word 2013.

Steps:
1- Download attached odt file and save as docx
2- Open the document with Word 2013, an error will popup and say the file is corrupted. Some part of the first table block becomes rectangular whitespace.

Saving with LibreOffice 4.3.2 is fine. No errors opening with Word

Version: 4.4.0.3
Build NO: de093506bcdc5fafd9023ee680b8c60e3e0645d7

Re bug: https://bugs.documentfoundation.org/show_bug.cgi?id=89297 (item 3 on comment 4)

Best regards,
Zeki
Comment 1 Zeki Bildirici 2015-02-11 19:32:01 UTC
Created attachment 113326 [details]
Corrupted doc version
Comment 2 raal 2015-02-13 15:36:08 UTC
I can confirm with Version: 4.5.0.0.alpha0+
Build ID: 62969accf9c01b71b738424d4d643db8bfaed182
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-02-08_23:22:32
word2010

docx version works, doc format is corrupted
Comment 3 A (Andy) 2015-12-27 20:56:36 UTC
(In reply to raal from comment #2)
> I can confirm with Version: 4.5.0.0.alpha0+
> Build ID: 62969accf9c01b71b738424d4d643db8bfaed182
> TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time:
> 2015-02-08_23:22:32
> word2010
> 
> docx version works, doc format is corrupted

Reproducible with LO 5.1.0.1, Win 8.1
Comment 4 Justin L 2016-10-10 09:28:41 UTC
Also shown as corrupted in Word 2003 and LO dev5.3.

Bibisect-44max: First bad commit:

    commit 80fd9fb7209cfd5c0622ee99d59e42e6db32f021
    Author:     Umesh Kadam <umesh.kadam@synerzip.com>
    CommitDate: Thu May 22 02:31:53 2014 -0500
    
        fdo#78333 : SdtContent and a Shape overlapping causes corruption
    
- Normally if there is a case where text/shape is overlapped with (another)
  shape then LO used to write the text and the AlternateContent in the same run.
- This is supported in MSO and there is no visual difference.
- But in case if the SdtContent(with text) is overlapped with the Shape then LO
  processes sdtContent as a text and ends up putting the alternateContent and the
  text in a single run. Ultimately it includes the entire run in a SdtContent,
  which is incorrect.
- The fix checks for the aforementioned scenario and puts them in a different run
  and also restricts the sdtContent being written in an invalid AlternateContent.
Comment 5 raal 2016-10-11 14:16:07 UTC
Adding Cc: to Umesh Kadam  ; Could you possibly take a look at this one?
Thanks
Comment 6 Justin L 2016-10-11 17:06:14 UTC
fix proposed at https://gerrit.libreoffice.org/#/c/29706/
Comment 7 Commit Notification 2016-10-13 06:50:27 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#89317 ww8export: don't corrupt table with postponed text

It will be available in 5.3.0.

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 8 Justin L 2016-10-16 14:53:04 UTC
Although parts of the description say docx instead of doc, this is actually a .doc bug and the fix in ww8export is in code for .doc only.
Comment 9 Luke 2016-10-16 18:43:20 UTC
Justin,
This fix does seem to affect .docx files too. Word 2007 .docx files that are roundtripped are now corrupted. I filed a new bug for this issue. 

Bug 103261 - FILESAVE: Fix for Bug 89317 corrupts roundtripped Word 2007 docx files