Thursday, February 14, 2008

Microsoft docx files on Ubuntu (Gusty)

Two Types of Installation

Here are two related ways to view *.docx files in ubuntu.

Troubleshooting Note:

If, after following the instructions below you get one of the following two errors, then the following should help you out (at least they did for me).

(This error occurs when installing the command line version:)

OdfConverter: error while loading shared libraries: libgif.so.4: cannot open shared object file: No such file or directory

(This error occurs when installing it directly into openoffice:)

Read-Error. Data could not be read from the file.

Then the following should help you out (at least they did it for me). Type the command:
  • locate libtiff.so
I had libtiff.so.4, but I need libtiff.so.3. Make the following symbolic link:
  • sudo ln -s /usr/lib/libtiff.so.4 /usr/lib/libtiff.so.3
Then use the command
  • sudo ldconfig
to update the library cache. Thanks to the poster at http://linux.derkeiler.com/Mailing-Lists/Ubuntu/2006-04/msg02897.html for this helpful instructions!

Command Line Converter Installation:

Install alien using Synaptic. Then download OpenOffice.OpenXML Translator 1.1.0 from here (unfortunately the download seems to require registration):

http://download.novell.com/Download?buildid=GuM6LMM9SR4~

Open a terminal window and run:
  • alien -ct odf-converter-1.0.0-5.i586.rpm
This will convert the rpm to a tgz file. Now you'll want to unpack the newly generated *.tgz. Then copy over the binary file to a directory in your path:
  • sudo cp usr/lib/ooo-2.0/program/OdfConverter /usr/bin
Usage:
  • OdfConvert /i example.docx

Want OpenOffice to open .docx directly. Here is how:

Follow the above directions up through the point of unpacking the newly generated *.tgz file. Now copy the following three files into your OpenOffice.org directories (note that the usr that you’re copying from is a directory that was inside the tgz file):
  • sudo cp usr/lib/ooo-2.0/program/OdfConverter /usr/lib/openoffice/program/
  • sudo cp usr/lib/ooo-2.0/share/registry/modules/org/openoffice/TypeDetection/Filter/MOOXFilter_cpp.xcu /usr/lib/openoffice/share/registry/modules/org/openoffice/TypeDetection/Filter/
  • sudo cp usr/lib/ooo-2.0/share/registry/modules/org/openoffice/TypeDetection/Types/MOOXTypeDetection.xcu /usr/lib/openoffice/share/registry/modules/org/openoffice/TypeDetection/Types/
Now you can open docx file using OOo! [If you get an error, look above at the troubleshooting notes.]

3 comments:

Andrew Z said...

odf-converter-integrator chocolate edition for Ubuntu does all this work for you.

josh said...

I'm not exactly sure why nobody else seems to have tried this, but if you download the odf-converter-x.x-x.oxt file from Novell's website, instead of the rpm, you can install it just as you would in Windows. AND, it will not only allow you to use .docx files it'll also do .xlsx and .pptx files as well. I'll outline the steps for you if you'd like:

Go to Applications > Office and open OpenOffice.org Word Processor
In OpenOffice.org Word Processor go to Tools > Extension Manager...
In Extension Manager click "Add..." and locate the .oxt file.

That's it!

Anonymous said...

The original error you listed references libgif, but the rest of your post references libtiff.

I got the libtiff error and fixed it the way you did, but then got the libgif error (and libgif, unlike libtiff, did not already exist on my system).

Anyway. Turns out you can just pull up your Synaptic Package Manager and have it grab libgif4

or if you're a cmd line guy:

sudo apt-get install libgif4

(why it's libgif4 and not libgif is beyond me!)