Bug 99017 - Cannot import non-csv file into Calc
Summary: Cannot import non-csv file into Calc
Status: RESOLVED DUPLICATE of bug 80016
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.3.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-01 09:41 UTC by PN
Modified: 2016-04-02 19:04 UTC (History)
2 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 PN 2016-04-01 09:41:39 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Build Identifier: LibreOffice 4.4.3.2

It seems not to be possibly to import a text file with an extension other that .csv into Calc. Renaming it works of course, but this is an awkward work-around if other applications rely on a different extension.

I tried: https://help.libreoffice.org/Calc/Importing_and_Exporting_CSV_Files but selecting "text CSV" as file type just makes the selected file disappear and the "Ok" button being greyed out.



Reproducible: Always

Steps to Reproduce:
1. Create text file with spread sheet data with extension other than csv
2. Start Calc and go to File->Open
3. Select the file. 
4. If you click "open", it will open in Writer instead of calc
5. If you select "text CSV" as suggested, it is deselected and one cannot proceed


Expected Results:  
I'd expect either an option to force-open any file regardless of its name in Calc, or a special "import text" option.

[Information automatically included from LibreOffice]
Locale: en-US
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes


Reset User Profile?No
Comment 1 Maxim Monastirsky 2016-04-01 09:51:53 UTC
Is this the same problem you reported previously in Bug 80016?
Comment 2 PN 2016-04-02 11:58:41 UTC
Yes it is, and sorry for re-filing this. I forgot about the old one and it
did not show up as hit when I submitted this new one...

However, I still find this behaviour disfunctional, because:

1) it forces a certain behaviour upon the user which clearly is not
intended (why would I open a word processor file in a spreadsheet
application?).

2) the behaviour is inconsistent. If I rename the same file to .csv, it
nevertheless opens in calc, ignoring the auto-file-type-detection.

3) opening a tab-delimited text file with a non-UTF8-encoding (because it
was copied from another OS or just is old) is not such a rare thing really... In fact, I would argue that this happens more often than to open a very old Word Perfect file that does not end in .wpd.

4) Finally, LibreOffice is an unique application, at least on Linux, with
no serious alternative. I find it problematic to impose such an
"auto"-behaviour upon the user, essentially making it impossible from him
to decide what is "right".

In summary, it would really be great to be able to turn this
auto-application-choosing off, either globally, or on a case by case basis.
Let the user decide what is right...
Comment 3 Maxim Monastirsky 2016-04-02 19:04:02 UTC
(In reply to PN from comment #2)
> Yes it is, and sorry for re-filing this. I forgot about the old one and it
> did not show up as hit when I submitted this new one...
Thanks for confirming. So I'll close this one as a duplicate.

> 1) it forces a certain behaviour upon the user which clearly is not
> intended (why would I open a word processor file in a spreadsheet
> application?).
Yes you right. Actually the overall design of LO's file type detection framework is to open (if possible) in the same app. It's just the WordPerfect detection that is messing with this. And this doesn't happen with all files, only with files that have chars identical to WP's "codes". (And there were other cases of a similar mis-detection caused by the detection code of other formats.)

Unfortunately it's not clear how to fix such thing, given that there is no way to "detect" csv files - as they are just plain text files, without any special header, so considering that a file is csv should be _always_ the last thing.

> 2) the behaviour is inconsistent. If I rename the same file to .csv, it
> nevertheless opens in calc, ignoring the auto-file-type-detection.
It isn't ignoring anything. It just that ".csv" is a "known" extension, so checking this format takes higher priority than other formats - so WordPrefect has no change to "catch" it.

> In summary, it would really be great to be able to turn this
> auto-application-choosing off, either globally, or on a case by case basis.
> Let the user decide what is right...
Based on what said above, I can suggest a workaround:

1. Open Tools->Options...
2. Switch to LibreOffice->Advanced.
3. Click on "Expert Configuration".
4. In the search field type "generic_Text" in hit Enter.
5. Under org.openoffice.TypeDetection.Types['generic_Text'] there is a property "Extensions" listing all known extensions for plain text files - just add your extension there.
6. Restart LO.

This does the trick for me with 5.1, but should work with your 4.4.3.2 too (but keep in mind that 4.4.x isn't supported by us anymore). Let me know if this won't work.

*** This bug has been marked as a duplicate of bug 80016 ***