Bug 70100 - FILEOPEN: Excel 2 sheet (xls) opens in writer
Summary: FILEOPEN: Excel 2 sheet (xls) opens in writer
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.1.1 rc
Hardware: Other All
: high major
Assignee: Maxim Monastirsky
URL:
Whiteboard: target:4.2.0 target:4.1.4
Keywords: bibisectRequest, regression
: 71604 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-10-03 20:00 UTC by Dave Richards
Modified: 2021-09-26 16:46 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
File that will not open (296.13 KB, application/vnd.ms-excel)
2013-10-03 20:00 UTC, Dave Richards
Details
as seen from 4.2 alpha, 4.1 gives general io error. (170.44 KB, image/png)
2013-10-03 20:34 UTC, Dave Richards
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Richards 2013-10-03 20:00:53 UTC
Created attachment 87087 [details]
File that will not open

This .xls file is generated by third party software as part of a fund management system.  The users were able to click on the "download xls" button and it immediately opened.  This worked fine with older versions.  Since 4.1, the file will not open.

In summary:

LO 4.0 opens the file fine
LO 4.1 does not open the file
LO 4.2 Alpha dated from today does not open the file
Comment 1 Jorendc 2013-10-03 20:28:48 UTC
Thanks for reporting!

I can reproduce this behavior using Mac OSX 10.8.4

Using LibreOffice Version 4.0.5.2 (Build ID: 5464147a081647a250913f19c0715bca595af2f) I can open the file as it should.
* Start LibreOffice
* In the start center: File > Open

-> Calc opens this file fine

Using Version: 4.1.2.3 Build ID: 40b2d7fde7e8d2d7bc5a449dc65df4d08a7dd38
* Start LIbreOffice
* In the start center: File > Open

-> Writer opens file and try to display content


Regression
Comment 2 Dave Richards 2013-10-03 20:30:59 UTC
That sounds like patches have been applied in this area after 4.1.1.  For me, I cannot file > open it from Calc.  I'm getting import filters that are tripping.  Will take screenshot.
Comment 3 Dave Richards 2013-10-03 20:34:22 UTC
Created attachment 87092 [details]
as seen from 4.2 alpha, 4.1 gives general io error.

It should be noted this is not the similar issue of HTML files that are called .xls.  This is actually a binary file.
Comment 4 Jorendc 2013-10-03 20:40:32 UTC
(In reply to comment #2)
> That sounds like patches have been applied in this area after 4.1.1.  For
> me, I cannot file > open it from Calc.  I'm getting import filters that are
> tripping.  Will take screenshot.

I can second that. Adding 'bibisectrequest' to determine which commit trigger this behavior.

Kind regards,
Joren
Comment 5 Dave Richards 2013-10-03 20:43:50 UTC
If this helps with the bisect:

Last known working that I have available:

4.0.1.2   

and fails on 4.1.1.1
Comment 6 m_a_riosv 2013-10-04 00:09:05 UTC
Opening the file with the filter:
  Microsoft Excel 97/2000/XP/2003 (*.xls,*.xlc,*.xlm,*.xlw,*.xlk)
I think works fine.
Comment 7 Dave Richards 2013-10-04 13:48:30 UTC
Confirmed, explicitly picking the right filter when opening worked.  So the bug is in the code that detects the file type.
Comment 8 m_a_riosv 2013-10-19 12:12:57 UTC
*** Bug 70631 has been marked as a duplicate of this bug. ***
Comment 9 Maxim Monastirsky 2013-10-22 10:04:31 UTC
Excel 2010 SP2 reports that this xls file is of 'Excel 2 Worksheet' format. That's why it doesn't happen with other xls files out there.

Looks related (but not the same) to Bug 68903.

(In reply to comment #2)
> That sounds like patches have been applied in this area after 4.1.1.  For
> me, I cannot file > open it from Calc.  I'm getting import filters that are
> tripping.  Will take screenshot.
Indeed, when opening from Calc I'm also getting the Import filter dialog, but when opening from the Start center it opens in Writer.
Comment 10 David Kolossa 2013-10-22 19:43:37 UTC
I tried bibisecting the issue on Ubuntu. Unfortunately, LibreOffice was unable to start in the critical region of commits.

However, the last known good commit I was able to find is  source-hash-7908692490120350f2ad45241f7b19ba52dc0489 the last bad one was source-hash-cb3ba53e3f995d4034bc5a9113015d81a1db30a4. git-bisect reports "33 revisions left to test after this" at this point.

This was my first bibisect I attempted, any hints on narrowing the range down further are appreciated. I hope this still helps!
Comment 12 Maxim Monastirsky 2013-10-23 19:08:50 UTC
Please ignore my previous comment. The real problem is in sc/source/ui/unoobj/exceldetect.cxx:isExcel40 function. For some reason nBofId=0x0809, and therefore the function return false. After adding 'case 0x0809:' or commenting the whole switch, the bug disappear. Strange that Excel 2010 identifies this file as 'Excel 2', while 0x0809 if for Excel 5.
Comment 13 Markus Mohrhard 2013-10-26 12:29:55 UTC
(In reply to comment #12)
> Please ignore my previous comment. The real problem is in
> sc/source/ui/unoobj/exceldetect.cxx:isExcel40 function. For some reason
> nBofId=0x0809, and therefore the function return false. After adding 'case
> 0x0809:' or commenting the whole switch, the bug disappear. Strange that
> Excel 2010 identifies this file as 'Excel 2', while 0x0809 if for Excel 5.

Can you create a patch and push it to gerrit?

I would then review it and push to master.
Comment 14 Maxim Monastirsky 2013-10-26 16:43:26 UTC
(In reply to comment #13)
> Can you create a patch and push it to gerrit?
Yes. I'm going to do that.
Comment 15 Maxim Monastirsky 2013-10-27 11:56:47 UTC
Patch is waiting for review:
https://gerrit.libreoffice.org/#/c/6447/
Comment 16 Commit Notification 2013-10-28 01:00:25 UTC
Maxim Monastirsky committed a patch related to this issue.
It has been pushed to "master":

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

fdo#70100 Detect single stream excel files with BOF ID 5



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 17 Dave Richards 2013-10-28 12:45:29 UTC
Can this be patched against 4.1 as well?  We have users that are down and this code won't be available to us until March 3, 2014 + in the form of 4.2.1.
Comment 18 Commit Notification 2013-10-28 14:04:05 UTC
Maxim Monastirsky committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=942aeb23bfdd7322ad9e239f19115ec9ceac6020&h=libreoffice-4-1

fdo#70100 Detect single stream excel files with BOF ID 5


It will be available in LibreOffice 4.1.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 19 Maxim Monastirsky 2013-11-14 14:20:52 UTC
*** Bug 71604 has been marked as a duplicate of this bug. ***
Comment 20 Yuhong Bao 2013-12-12 20:56:55 UTC
Playing around with Excel 2003 and a binary editor, FYI if the first two bytes are 0x0809, then the byte at offset 5 is used to determine the major version (values should be obvious with the exception of byte value 0x06 being used to indicate Excel 97). If it is unknown, the file is treated as an Excel 2.1 file.
Comment 21 Dave Miller 2014-01-16 04:51:00 UTC
(In reply to comment #18)
> It will be available in LibreOffice 4.1.4.

I am using LibreOffice Version: 4.1.4.2 Build ID: 0a0440ccc0227ad9829de5f46be37cfb6edcf72 on Mac OS X 10.9.1, and this problem still exists.
Comment 22 Dave Miller 2014-01-16 05:15:40 UTC
OK, I guess I jumped too soon...  the document in question has an .xls suffice, but appears to actually contain HTML content (root element is a <div> and that contains a <table>) rather than Excel binary data.  I found other xls files with proper excel data in them which open correctly.

However, I've been downloading these xls files from this same site (it's the data export from an event registration site) for a long time, and in LibreOffice 4.0.x it would open them in Calc.  I had a bunch of the older files sitting around, and they have always been in this format (I just upgraded to 4.1.x from 4.0.x).

In this case, selecting one of the Excel filetypes from the selector results in an error trying to open the file, but if I create a new Calc document, then do File > Open from there, it correctly opens it like it used to.

Sounds like another variant of Bug 68903 and probably deserving of a new bug rather than reopening this one, so sorry for the spam.  Off to file a new bug.
Comment 23 Dave Miller 2014-01-16 05:24:33 UTC
(In reply to comment #22)
> Off to file a new bug.

The HTML as xls file open bug is now bug 73682.
Comment 24 Robinson Tryon (qubit) 2015-12-17 07:32:23 UTC
Migrating Whiteboard tags to Keywords: (bibisectrequest)
[NinjaEdit]