Download it now!
Bug 68903 - FILEOPEN: CSV files with .xls suffix are opened as Writer documents
Summary: FILEOPEN: CSV files with .xls suffix are opened as Writer documents
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: Other All
: medium normal
Assignee: Maxim Monastirsky
URL:
Whiteboard: BSA target:4.2.0 target:4.1.4
Keywords: regression
: 69290 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-03 18:57 UTC by chdiza
Modified: 2014-11-07 09:23 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chdiza 2013-09-03 18:57:29 UTC
Problem description: 

On MacOSX 10.8.4, when I try to open a documents with suffix .xls, LibreOffice 4.1.1 opens it as a Writer documents, which of course is totally wrong.  Version 4.0.4 and 4.0.5 don't do this.

It's even weirder with files named "foo.csv.xls".  Until version 4.1.1, these would open as Calc documents and I would get the splash screen where I can choose the column separator and text encoding and so forth.  As of 4.1.1 I get a new Writer document with the csv data lumped into it.

If I remove the 'xls' part, leaving 'foo.csv', then LO 4.1.1 will finally realize it's a Calc document, and it will show me the dialog box for the separator, encoding, etc.  But bizarrely, the default text encoding is Cyrillic, which is completely ridiculous (all my files are ASCII, and I have the US English version of LibreOffice).
Operating System: Mac OS X
Version: 4.1.1.1 rc
Comment 1 Maxim Monastirsky 2013-09-14 19:50:07 UTC
*** Bug 69290 has been marked as a duplicate of this bug. ***
Comment 2 Maxim Monastirsky 2013-09-15 08:02:26 UTC
Can confirm with LO 4.1.0.4, 4.1.1.2, 4.1.2.1 under Windows 7 (32-bit). CVS file with xls suffix opens in Writer when opening using Start Center shortcut or soffice.exe. This doesn't happen when opening from Calc, or double-clicking in explorer (because in Windows it's associated with Calc, not with soffice.exe). Same for TSV files (like in Bug 69290). In both cases it works with 4.0.5.2 without problems.

Similar behavior can be observed with HTML file that has xls suffix. With 4.0.5.2 it opens in Calc, while with 4.1.2.1 it opens in Writer\Web. Can't test that combination with 4.1.0\4.1.1 due to Bug 67699.
Comment 3 Russ Fineman 2013-10-20 16:37:54 UTC
Just experienced same behavior on LibreOffice:
Version: 4.1.1.2
Build ID: 410m0(Build:2)
openSuse supplied.

openSUSE 12.3(Linux 3.11.1-3.gfeffbf9-desktop)|KDE 4.11.2
|Intel core2duo 2.5 MHZ,|8GB DDR3|GeForce 8400GS
(NVIDIA-Linux-x86_64-325.15 Patched)  

I consider this higher priority than above.

Work Around:

Go to file associations (depends on OS where it at.
Select .csv and add Calc to list of applications that open .csv. Then make Calc highest one. 

Not sure why the default was made text.

Russ
Comment 4 Russ Fineman 2013-10-20 16:39:58 UTC
Note on Comment #3:

this was trying to open a saved .csv file.
Comment 5 Maxim Monastirsky 2013-10-22 09:43:05 UTC
(In reply to comment #4)
> this was trying to open a saved .csv file.
Hi Russ Fineman,
This bug is about .xls files with CSV content, not about .csv file. So I think that you should open a new bug report for your problem.
Comment 6 Russ Fineman 2013-10-22 20:14:20 UTC
The original document was a .ods saved as .csv, then tried to re-open it. The real problem is the file assocication, (.csv is associated to writer, not calc. In fact there is no memtion of calc in the .csv file association. I will open it in openSUSE? I would assume LibreOffice does not set-up the openSUSE file associations.

If calc sets up file associations, let me know and I will open a new one against Calc.

Thanks for your response.

Russ
Comment 7 Maxim Monastirsky 2013-10-23 12:24:10 UTC
(In reply to comment #6)
> The real problem is the file assocication, (.csv is associated to writer,
> not calc. In fact there is no memtion of calc in the .csv file association.
> I will open it in openSUSE? I would assume LibreOffice does not set-up the
> openSUSE file associations.
> 
> If calc sets up file associations, let me know and I will open a new one
> against Calc.
> 
There is no bug in LibreOffice for sure, as Calc's .desktop file does define the association with .csv files. The problem might be in your distribution\desktop environment. It's easy to check: You should navigate to /usr/share/applications, locate the libreoffice-calc.desktop file, and open it in a text editor. The line starting with MimeType= should contain 'text/csv' entry. If it's there, then the bug is in your desktop environment (KDE?). Otherwise you should report it to your distribution. But before reporting the bug, I suggest also to check the .local/share/applications folder in your user profile, which might override your global system settings.
Comment 8 Maxim Monastirsky 2013-10-23 19:24:32 UTC
I've found how to fix that problem. In filter/source/textfilterdetect/filterdetect.cxx in function PlainTextFilterDetect::detect, the following code should be added:
else if (aExt == "xls")
 setPropValue(lDescriptor, nFilter, "FilterName", OUString(CALC_TEXT_FILTER));
Same could be done for tsv.
Comment 9 Russ Fineman 2013-10-24 16:00:15 UTC
On Wednesday, October 23, 2013 12:24:10 PM bugzilla-
daemon@freedesktop.org wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=68903
> 
> --- Comment #7 from Maxim <momonasmon@gmail.com> ---
> (In reply to comment #6)
> 
> > The real problem is the file assocication, (.csv is associated to
> > writer, not calc. In fact there is no memtion of calc in the .csv
> > file association. I will open it in openSUSE? I would assume
> > LibreOffice does not set-up the openSUSE file associations.
> > 
> > If calc sets up file associations, let me know and I will open a new
> > one against Calc.
> 
> There is no bug in LibreOffice for sure, as Calc's .desktop file does
> define the association with .csv files. The problem might be in your
> distribution\desktop environment. It's easy to check: You should
> navigate to /usr/share/applications, locate the
> libreoffice-calc.desktop file, and open it in a text editor. The line
> starting with MimeType= should contain 'text/csv' entry. If it's
> there, then the bug is in your desktop environment (KDE?). Otherwise
> you should report it to your distribution. But before reporting the
> bug, I suggest also to check the .local/share/applications folder in
> your user profile, which might override your global system settings.
> 
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
I found them. In openSUSE 12.3 the file is call calc.desktop and is 
located in /usr/share/applications and /usr/lib64/libreoffice/share/xdg/

Contents of the Mine Line is( same in both locations above):

Code
----------
MimeType=application/vnd.oasis.opendocument.spreadsheet;application/
vnd.oasis.opendocument.spreadsheet-
template;application/vnd.sun.xml.calc;application/
vnd.sun.xml.calc.template;application/msexcel;application/vnd.ms-
excel;application/vnd.openxmlformats-
officedocument.spreadsheetml.sheet;application/vnd.ms-
excel.sheet.macroenabled.12;application/vnd.openxmlformats-
officedocument.spreadsheetml.template;application/vnd.ms-
excel.template.macroenabled.12;application/vnd.ms-
excel.sheet.binary.macroenabled.12;text/csv;application/x-
dbf;text/spreadsheet;application/csv;application/excel;application/tab-
separated-
values;application/vnd.lotus-1-2-3;application/vnd.oasis.opendocument
.chart;application/vnd.oasis.opendocument.chart-template;application/x-
dbase;application/x-dos_ms_excel;application/x-excel;application/x-
msexcel;application/x-ms-excel;application/x-
quattropro;application/x-123;text/comma-separated-values;text/tab-
separated-values;text/x-comma-separated-values;text/x-csv;
----------
Note: last entry appears to be the addition of .csv I added. I will 
check it on my openSUSE 13.1RC1 setup and see if its there. If not I'll 
report it to openSUSE.

Thanks for your help.

Russ
Comment 10 Maxim Monastirsky 2013-10-27 11:58:23 UTC
Patch is waiting for review:
https://gerrit.libreoffice.org/#/c/6448/
Comment 11 Commit Notification 2013-10-28 12:41:42 UTC
Maxim Monastirsky committed a patch related to this issue.
It has been pushed to "master":

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

fdo#68903 Import .tsv and .xls plain text files in Calc by default



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 12 Commit Notification 2013-10-28 14:04:24 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=e08785bc0a5bf75d4866a23ee62c591611d475c5&h=libreoffice-4-1

fdo#68903 Import .tsv and .xls plain text files in Calc by default


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 13 C. Andrews Lavarre 2014-11-07 04:59:51 UTC
Contrary to this report, it has NOT been fixed in

Version: 4.1.6.2
Build ID: 410m0(Build:2)

The same thing happens as in all these reports:

I create a CSV file, name it as e.g., test.xls

I right click in Konqueror, choose Open with LibreOffice Calc

and Writer opens.

Maybe it is an issue with KDE?

I'm under openSUSE 13.1, KDE Platform Version 4.11.5

Cheers, Andy
Comment 14 Maxim Monastirsky 2014-11-07 09:23:29 UTC
(In reply to C. Andrews Lavarre from comment #13)
> Contrary to this report, it has NOT been fixed in
> 
> Version: 4.1.6.2
> Build ID: 410m0(Build:2)
> 
> The same thing happens as in all these reports:
> 
> I create a CSV file, name it as e.g., test.xls
> 
> I right click in Konqueror, choose Open with LibreOffice Calc
> 
> and Writer opens.

Hi,

Keep in mind that:
1. It's never a good idea to reopen old bugs. Instead always open a new bug, and reference the old one (and if needed add the developer to the CC list).
2. Version 4.1.6 is not supported for a very long time now. Never report bugs without making sure that they're still reproducible with the latest version (currently 4.3.3 and master).
3. The problem you describe is different than the one I fixed here. This bug is about csv files with .xls extension that open fine when you explicitly open them using Calc. In your case it doesn't open in Calc even when you explicitly choose Calc.
4. Given your reproduction steps, I seems much like a false detection described in Bug 78731 and/or Bug 80016. (Although I can't know for sure without seeing your file.)