Open docx files in OpenOffice on Ubuntu

I’ve been using Office 2007 quite happily for some time now. But the niggles are starting to hit me.

One of the main issues is the new .docx format not being supported across the board yet. And with me being a sucker for all things new, I have to make a point of saving an alternate version to open in OpenOffice.

Until now.

I found this little nugget on the Ubuntu forums to install the Novell converter in Ubuntu:

1) Download the file odf-converter-1.0.0-5.i586.rpm from http://download.novell.com/SummaryFree.jsp?buildid=ESrjfdE4U58~

2) Use alien to convert it to a Slackware tgz file

<code>alien -ct odf-converter-1.0.0-5.i586.rpm</code>

3) Unpack the slackware tgz file

<code>tar xzf odf-converter-1.0.0.tgz</code>

4) Copy 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 (3 lines here)

<code>sudo cp usr/lib/ooo-2.0/program/OdfConverter /usr/lib/openoffice/program/</code>
<code>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/</code>
<code>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/</code>

Once I restarted OpenOffice, I found that it could import basic docx files quite happily.

This worked nicely for me in Feisty Fawn – although it’s a good idea to make sure that OpenOffice is up-to-date.

Drag and Drop Convert Word to PDF

Sometimes I find that it’s useful to save my Word documents as PDFs.

After playing around with the Save As PDF plugin for Office, I decided that it would be cool if I could write a script to convert a job lot of Word documents.

Prerequisites
MS Word 2007
Save As PDF Office 2007 Plugin

Just copy and paste the code into Notepad and save the file as WordToPDF.vbs on your desktop.

<code>'Word to PDF
'By John Reid
'(c) 2007 bloggingIT - http://www.maxpower.plus.com
'Feel free to use, modify, and redistribute - just leave the credits intact
'Quick Export to PDF
Const wdExportAllDocument = 0
Const wdExportOptimizeForPrint = 0
Const wdExportDocumentContent = 0
Const wdExportFormatPDF = 17
Const wdExportCreateHeadingBookmarks = 1

if  Wscript.Arguments.Count > 0 Then
  'Fire up MS Word 2007
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objWord = CreateObject("Word.Application")

  'Enumerate the passed in file names
  For i = 0 to wscript.arguments.count - 1
  Set objFile = objFSO.GetFile(WScript.Arguments(i))
  Set objDoc = objWord.Documents.Open(WScript.Arguments(i),,TRUE)
  dirPath = objFSO.GetParentFolderName(objFile)
  fileBaseName = objFSO.GetBaseName(objFile)
  'Export to PDF using preferred settings
  pdf = objWord.ActiveDocument.ExportAsFixedFormat _
    (dirPath & "\" & fileBaseName & ".pdf", _
    wdExportFormatPDF, False, wdExportOptimizeForPrint, _
   wdExportAllDocument,,, _
   wdExportDocumentContent, _
   False, True, _
   wdExportCreateHeadingBookmarks)
 Next
 'Quit MS Word
 objWord.Quit(False)
Else
 msgbox("You must select a file to convert")
End If</code>

When you find a document that you wish to convert, just drag and drop the file onto the script.

Right, there’s an Excel version along shortly.

MS Word’s Blogging Time Tunnel

Some people have commented that I seem to have started my blog in 1970. Those more in the know will realise that it’s about a decade before I was born, nevermind the fact that the Web wasn’t around then.

It’s Microsoft Word’s built-in blogging feature. I’ll give it credit. At least it managed to post the article straight into WordPress. Pity that it doesn’t know what date it is yet.