Frequently asked questions - Calc

From The Document Foundation Wiki
< Faq‎ | Calc
Jump to: navigation, search

How to open text files with an extension other than .CSV or .TXT (.TAB, .PRN,...) in Calc

By default, files with the extension .tab open as text documents in Writer, although they are often CSV files which should be opened with Calc.

The first solution is to rename the file as .CSV and then follow these instructions.

However, if you often need to handle this type of file, it may be easier to change the configuration of LO to consider such files as CSV files.

In what follows <LibreOffice> represents the installation directory of LibreOffice, for example:

  • MS-Windows : C:\Program Files\LibreOffice 3\
  • linux : /opt/LibreOffice/

To open .TAB files with the CSV filter of LibreOffice, follow these instructions:

  1. Close LibreOffice and its quick launcher.
  2. Make a backup copy of the file <LibreOffice>/Basis/share/registry/calc.xcd
  3. Edit it.
  4. Search for this string: calc_Text_txt_csv_StarCalc. The second occurrence of the string will look like this:
     <node oor:name="'''calc_Text_txt_csv_StarCalc'''" oor:op="replace" > 
        <prop oor:name="DetectService">
           <value>com.sun.star.comp.calc.FormatDetector</value>
        </prop> 
        <prop oor:name="URLPattern"/> 
        <prop oor:name="Extensions">
           '''<value>csv txt xls</value>'''
        </prop> 
        <prop oor:name="MediaType">
           <value>text/plain</value>
        </prop> 
        <prop oor:name="Preferred">
           <value>false</value>
        </prop> 
        <prop oor:name="PreferredFilter">
           <value>Text - txt - csv (StarCalc)</value>
        </prop> 
        <prop oor:name="UIName">
           <value>Text - txt - csv (StarOffice Calc)</value> 
        </prop> 
         <prop oor:name="ClipboardFormat"/>
     </node>
    

    Note : to save space, the return characters at the ends of the lines have been omitted in this file. This makes it difficult for human beings to read it. If you wish, you can insert the returns.

  5. Modify the line: <prop oor:name="Extensions"> <value>csv txt xls</value> </prop>
  6. Add the extensions that you want to have recognised, for example: <prop oor:name="Extensions"> <value>csv txt xls tab prn</value> </prop>
  7. Save the file.

The next time you open LibreOffice with a file that has the extension in question, the CSV file opening dialog will be displayed.