Turn OpenOffice.org into a Web-editing tool with ODF@WWW


Author: Dmitri Popov

Imagine being able to open any Web page on your server in OpenOffice.org, edit it, and save the changes back to the server by pressing the Save button. It may sound too good to be true, but that’s exactly what the ODF@WWW project is set to achieve.

Started as a relatively simple hack, ODF@WWW has become a nifty solution that allows end users to create and edit Web pages in OpenOffice.org. ODF@WWW is based on three components: a few custom configuration options in the Apache server, the JODConverter utility, and a couple of bash scripts.

According to Kay Ramme, ODF@WWW’s developer, OpenOffice.org already has the ability to open and store documents on a WebDAV-enabled Apache server. What was needed was a way to convert any saved OpenOffice.org document into an HTML page, as well as forward any HTML page to OpenOffice.org for editing. With ODF@WWW, this is done using a few simple scripts that are executed by Apache when the user requests a specific HTML page. The convert.sh script, for example, does two things: if the requested HTML page doesn’t exist or it’s older than the corresponding .odt or .ods document, the script converts the current OpenOffice.org document to an HTML file using JODConverter, then outputs the content of the requested page to stdout, where Apache takes it and sends it back to OpenOffice.org. The redirect.sh script then delivers the requested HTML page to OpenOffice.org, and the same JODConverter utility converts the edited ODF document back to the HTML format when the user saves the document. For a more detailed description of ODF@WWW’s inner workings, see Kay Ramme’s blog.

The good news is that end users don’t need to know anything about all the technicalities. Once installed and configured, ODF@WWW does the job in the background, providing seamless integration between the user’s Web server and OpenOffice.org.

To install ODF@WWW you need a local Linux-based machine. There are two reasons for that: First, ODF@WWW relies on several external applications such as JODConverter and OpenOffice.org that must run on the same machine as the Apache Web server, and second, the current version of ODF@WWW doesn’t include any access control features, so it’s better suited for deployment on a local server. Installing ODF@WWW is straightforward, and can be done using just a few commands. Here’s how to do it on Ubuntu. Open Terminal and execute the xhost + localhost command to allow the local server to make a connection to the local machine’s X server. Next, use the sudo -i command to become root, and install the Apache server and OpenJDK package using apt-get:

apt-get install apache2 openjdk-6-jre-headless

You could, of course, use sudo apt-get, but since the installation process consists of several more commands that require root privileges, it’s easier to switch to the sudo mode here. Next, fetch and unpack the odf-at-www.tgz archive, and download and install JODConverter:

cd / wget http://mediacast.sun.com/users/Kay.Ramme/media/odf-at-www.tgz tar -xvzf odf-at-www.tgz cd /opt/odf-at-www/cgi-bin wget http://mesh.dl.sourceforge.net/sourceforge/jodconverter/jodconverter-2.2.1.zip unzip jodconverter-2.2.1.zip cd /

Finally, change the owner for the odf-at-www directories to www-data:

chown -R www-data:www-data /var/odf-at-www /opt/odf-at-www

Now you can launch an OpenOffice.org instance that accepts connections on port 8100 (which is used by the JODConverter tools to convert ODF documents to HTML) and restart Apache:

export SAL_USE_VCLPLUGIN=gen export DISPLAY=:0 soffice -accept="socket,port=8100;urp;" apache2ctl restart

Point your Firefox browser to http://localhost:1234 and you should see the default starting page. If everything works properly, you should see a toolbar in the browser containing the Edit button. Before you can press it to open the page for editing, you have to create a simple redirect script that sends the page to OpenOffice.org. To do this, create a plain text file in your home directory, and enter the following code:

#!/bin/sh /usr/bin/soffice `cat $1`

Save the file as redirect.sh. To set up a redirect script for a Windows machine, create a redirect.bat file containing the following command:

FOR /F %%v IN (%1) DO "c:Program FilesOpenOffice.org 2.4programsoffice.bin" %%v

Now, when you press the Edit button in the browser, it prompts you to choose a helper application for the selected .odtr document. Choose the redirect.sh script (or redirect.bat on Windows) and press OK. This opens the document in OpenOffice.org Writer. If the Web page was created using Calc, it will be automatically converted into a spreadsheet document and opened in Calc. Make a few changes to the document, save it, and refresh the page in Firefox, and you should see the changes you made.

Adding new pages or documents to your site is equally simple. Similar to a wiki, you can create a page by inserting a URL to it into the currently edited document. When you then save the document and click on the link in the browser, you are redirected to an empty page containing some default text. The empty page is generated using the dummy.odt file (or dummy.ods for spreadsheet documents), so you can use these as a template for new pages by editing their contents.

If you would like to see ODF@WWW in action before you install it on your machine, view the video on the GullFOSS blog, which provides a demonstration of ODF@WWW’s functionality.

Although the ODF@WWW project is still in its infancy, it shows a lot of promise. You probably wouldn’t want to use it in a production environment just yet, but you might want to give it a try if you need to edit Web pages on your own local server. The project has its own wiki page, though there is not a lot of information in it yet, but expect this to change as the project gets more traction with developers and users.


  • Integration
  • Internet & WWW
  • Office Software