Bug 49120 - FILESAVE: LibreOffice corrupts XLSX file
Summary: FILESAVE: LibreOffice corrupts XLSX file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.2 release
Hardware: x86-64 (AMD64) Windows (All)
: highest critical
Assignee: Not Assigned
URL:
Whiteboard: target:4.1.0 target:4.0.3
Keywords:
Depends on:
Blocks: mab4.0
  Show dependency treegraph
 
Reported: 2012-04-24 15:10 UTC by Jason
Modified: 2013-12-23 15:24 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A zip file with two sample files - one corrupt and one not corrupt (57.74 KB, application/zip)
2012-04-24 15:10 UTC, Jason
Details
Glitches after saving and reloading (82.25 KB, image/png)
2012-08-30 07:23 UTC, mondane.woodworker
Details
quick-fix-patch (2.09 KB, patch)
2013-04-06 08:28 UTC, ikartur
Details
Test file after modification in the fixed LibreOffice. (20.10 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2013-04-08 14:33 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason 2012-04-24 15:10:28 UTC
Created attachment 60547 [details]
A zip file with two sample files - one corrupt and one not corrupt

I have a file created created in Excel 2010 and saved in XLSX format.
If I simply open this file and any minor change (just something to enable the save button) and then save it in LibreOffice the file becomes corrupt.

If I open again (after savings and closing) in LibreOffice the row and column headings are not visible and and worksheets are gone.

If I open it in Excel it reports the file it corrupt.

This is a major issue for us (and I would imagine others?) as it actually appears to completely ruin the file.  Not displaying correctly is one thing but we had to halt use of Libre for the time being as this is happening on many computers in our organization.

I have attached the file before corruption and after corruption (zipped to one file).

I am running Windows 7 64-bit but this ha also happened on Windows XP as well.
LibreOffice is version 3.5.2.2
Comment 1 bfoman (inactive) 2012-04-26 02:20:38 UTC
Confirmed with:
LOdev 3.5.3rc1+ 
Build ID: 51648779-22e3d74-d554af7
Windows 7 Professional SP1 64 bit
Comment 2 mondane.woodworker 2012-08-15 21:26:22 UTC
Also confirmed with:
LibreOffice 3.5.4.2 
Build ID: 350m1(Build:2)
Ubuntu 12.04.1 LTS 64bit
Comment 3 Lekow 2012-08-24 15:41:07 UTC
NOT confirmed in 
LibreOffice 3.6.0.4 (Build ID: 932b512)
Windows 7 Starter SP1 32 bit
Comment 4 mondane.woodworker 2012-08-30 07:23:34 UTC
Created attachment 66316 [details]
Glitches after saving and reloading

I tested it with LibreOffice 3.6.1.2 (Build-id: e29a214 on Windows XP 32bit), after saving, the file can be opened but looks corrupt.

See screenshot 2012-08-30_09h03m_before_after.png .

NB Before I changed anything, I placed the cursor in cell A1. After opening the saved file again, this is what I noticed:

- not A1 is shown, but some other part of the sheet
- graphical glitches, ie cell numbers dissappear

I didn't check to see if all formulas stayed the same.
Comment 5 Jason 2012-09-04 03:10:03 UTC
CONFIRMED: 
Windows 7 64 bit SP1
Libre-Office 3.6.1.2 Build: e29a214

This issue still occurs as mondane.woodworker also confirmed.

Still a big issue as it destroys existing files with no way (that I can see) of getting them back.
Comment 6 bfoman (inactive) 2012-10-11 20:47:52 UTC
Confirmed with:
LO 3.6.3.1
Build ID: f8fce0b
Windows XP Professional SP3

Graphical glitches after saving and reloading. All sheets are switched from Window>Freeze to Window>Split option. When switched back the graphics is rendered correctly. No data corruption at first sight.
Comment 7 WarrenK 2013-01-10 19:36:41 UTC
Confirmed still bug in v3.6.4 on Windows7 32bit
Corrupts save of .xlsx file.  Loosing all tabs to all other sheets in workbook and alphabetic column headings, probably more but these are most apparent looses.
Comment 8 Hunter 2013-01-29 14:13:23 UTC
Also confirmed with:
LibreOffice 3.6.3.2 
Build ID: 58f22d5
Windows 7 Professional SP1 64 bit


After the file was created in MS-Office, save as a .xlsx
Opened in LibreOffice worked on it and saved again as .xlsx

Now some data is inaccessible.

Is there any way of retrieving the data back???
Comment 9 Jason 2013-01-29 14:17:27 UTC
Unfortunately there appears not to be any way to get it back - that is why this is such a critical bug.  It is 100% reproducible and yet it has been sitting here for 8 months.

(In reply to comment #8)
> Also confirmed with:
> LibreOffice 3.6.3.2 
> Build ID: 58f22d5
> Windows 7 Professional SP1 64 bit
> 
> 
> After the file was created in MS-Office, save as a .xlsx
> Opened in LibreOffice worked on it and saved again as .xlsx
> 
> Now some data is inaccessible.
> 
> Is there any way of retrieving the data back???
Comment 10 Jason 2013-01-29 14:24:25 UTC
CONFIRMED again - LO 4.0.0.1 (RC1) Windows 7 64-bit

Open the file marked "Good" (in the zip file attached to this post) - make a change and save it.  The file is then corrupt.

This is extremely serious -I don't know anyone that does not interact with MS Office users at some point - the fact that you have the potential to lose data is a serious problem.
Comment 11 Som 2013-02-22 14:19:25 UTC
CONFIRMED again - LO 4.0.0.3 (release) Windows 7 64-bit.

This is a very serious issue.
Comment 12 Jason 2013-02-22 14:28:16 UTC
Yes this is a very serious issue - how can we get any attention put on it though?  Nobody seems to care, it has been here for almost a year.
Comment 13 bfoman (inactive) 2013-02-23 11:03:22 UTC
Please do not change the version field as this indicate the earliest version where bug was reproduced. I will set it to 3.5.2 release per original report. If this bug is reproducible in newer versions - please add a comment and leave the Version field unchanged.
Comment 14 Som 2013-03-07 08:02:06 UTC
(In reply to comment #13)
> Please do not change the version field as this indicate the earliest version
> where bug was reproduced.

Oh, then it is the exact opposite how RedHat/Fedora bugzilla works. There reports for old versions are closed (WONTFIX) and people are asked to clone the report for new versions.

I wonder whether it would make sense to create a new bug report for LO 4.x as "blocker" merely asking for XLSX saving to be disabled entirely until this bug is solved.
Comment 15 ringe 2013-03-14 12:23:21 UTC
Hi everyone. I need this bug/feature so much that I'm willing to pay 100.00 bucks for it.
This offer is registered at FreedomSponsors (http://www.freedomsponsors.org/core/issue/218/filesave-libreoffice-corrupts-xlsx-file).
Once you solve it (according to the acceptance criteria described there), just create a FreedomSponsors account and mark it as resolved (oh, you'll need a Paypal account too)
I'll then check it out and will gladly pay up!

If anyone else would like to throw in a few bucks to elevate the priority on this issue, you should check out FreedomSponsors!
Comment 16 Jason 2013-03-14 12:37:59 UTC
I also added $100 to the pot.
Comment 17 László Németh 2013-04-05 13:05:31 UTC
It seems, the problem is fixed in LibO 4.0.1: After modification of the test file in 4.0.1, the result is not corrupt or empty in LibreOffice. The result is attached for MS Office testing.
Comment 18 László Németh 2013-04-05 13:15:29 UTC
(In reply to comment #17)
> It seems, the problem is fixed in LibO 4.0.1: After modification of the test
> file in 4.0.1, the result is not corrupt or empty in LibreOffice. 

Oops, the result is the same as in the attached screenshot, so this filter problem hasn't fixed yet in LibO 4.0.1.
Comment 19 László Németh 2013-04-05 13:30:20 UTC
(Possible workaround: using XLS (Microsoft Excel 97/2000/XP/2003 .xls) instead of XLSX. The XLS output filter keeps all worksheets of the test file.)
Comment 20 Jason 2013-04-05 18:42:56 UTC
Yes XLS is a workaround but each day XLSX becomes more popular and you can't control the format the people will send you documents in.  

(In reply to comment #19)
> (Possible workaround: using XLS (Microsoft Excel 97/2000/XP/2003 .xls)
> instead of XLSX. The XLS output filter keeps all worksheets of the test
> file.)
Comment 21 ikartur 2013-04-06 08:28:15 UTC
Created attachment 77511 [details]
quick-fix-patch

This is a quick patch that probably fixes this "file-corruption", which is caused by a minor missing feature.
Comment 22 Andras Timar 2013-04-07 08:21:50 UTC
(In reply to comment #21)
> Created attachment 77511 [details] [review]
> quick-fix-patch

Thanks! Can you please send a blanket license statement to libreoffice@lists.freedesktop.org, saying:

"All of my past & future contributions to LibreOffice may be licensed under the MPL/LGPLv3+ dual license."
Comment 23 Commit Notification 2013-04-08 14:23:21 UTC
Iranyossy Knoblauch Artur committed a patch related to this issue.
It has been pushed to "master":

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

fdo#49120 - Implementig XML_state



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 24 László Németh 2013-04-08 14:31:49 UTC
I have tested it. It seems, only the background colors have changed to black in the test file, so I hope, the modified XLSX will be good for Excel, too. The result will be attached to test it.

Many thanks for the fix!
Comment 25 László Németh 2013-04-08 14:33:02 UTC
Created attachment 77597 [details]
Test file after modification in the fixed LibreOffice.
Comment 26 László Németh 2013-04-08 14:53:09 UTC
Note: background colors are correct in the Google Doc XLSX preview (Google Doc cannot edit the original and the modified XLSX test files).
Comment 27 Commit Notification 2013-04-08 16:20:19 UTC
Iranyossy Knoblauch Artur committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0c96156ec20b0092e7909cc06e1f0c5c4d29a05d&h=libreoffice-4-0

fdo#49120 - Implementig XML_state


It will be available in LibreOffice 4.0.3.

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 28 Jason 2013-04-08 18:02:34 UTC
This corrected the corruption - the workbook opens in Excel 2010 and 2013 now.  It does loose cell borders and some background coloring though.
Comment 29 Philip Horger 2013-04-26 16:55:48 UTC
@ikartur

Thanks for your fix! If you could please create an account at FreedomSponsors, me and the two other people who sponsored the bug there will be able to pay you the combined $300 bounty for the bug.

http://www.freedomsponsors.org/core/issue/218/filesave-libreoffice-corrupts-xlsx-file

No particular rush. But we can't pay you until you have an account, and have added yourself as a worker on the bug.
Comment 30 Vikram 2013-12-23 11:42:21 UTC
Hello All,

I am trying to convert Micorsoft XLSX file to PDF using Libre Office 4.0.1 and latest version of Libre office 4.1.4, but the PDF which is forming is corrupted. (Some portion of xlsx file is not saving in PDF file)

Kindly please let me know what is the solution for the above query. Any help ASAP is really appritiated.

Regards
Vikram
Comment 31 retired 2013-12-23 12:31:42 UTC
This is fixed. Just look at: http://freedomsponsors.org/core/issue/218/filesave-libreoffice-corrupts-xlsx-file payment has been made.

If any pdf export fails, please open a separate new bug, since this bug is about something else. Thanks :)
Comment 32 bfoman (inactive) 2013-12-23 15:24:52 UTC
Please do not change the version field as this indicate the earliest version where bug was reproduced. I will set it to 3.5.2 release per original report.