Friday, August 17, 2007

Getting an OpenXML (.docx) file to open in OpenOffice.

So someone sent me this .docx file the other day. I don't have office installed and in fact I had no idea what .docx was. I actually thought it was a typo but after a little googling noticed it was the extension for Microsoft's new OpenXML format which is not yet standardized but can be looked up under ECMA 376. So how do you get it to open up in OpenOffice?

If you are using a RedHat, Suse, or other RPM based distribution, then its easy. Just go to Novell and download then install the ODF convertor.

If your running a debian based distribution, its a little more difficult. You still need to download the ODF convertor. Save it to a smart location like /downloads/ODF Convertor

Now if you don't have Alien installed, then you need to install it. Say yes to all the prompts.


root@laptop:~# apt-get install alien


Now we need to convert the RPM to a tar.gz file.


root@laptop:~/ODF Convertor# alien -ct odf-converter-1.0.0-5.i586.rpm


Now that the tar.gz file is generated, you need to extract it. I just used Gnome's fileroller but you can use the cammand line if you want.

Next we need to copy a bunch of files. Browse to the location where you extracted these files. then run the following commands.


root@laptop:~/ODF COnvertor/odf-converter-1.0.0.tgz_FILES# cp usr/lib/ooo-2.0/program/OdfConverter /usr/lib/openoffice/program/

root@laptop:~/ODF COnvertor/odf-converter-1.0.0.tgz_FILES# 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/

root@laptop:~/ODF COnvertor/odf-converter-1.0.0.tgz_FILES# 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/


Thats it! Now just open OpenOffice and try to open your .docx file. It should work flawlessly.