LJ Archive

Creating Web Pages with OpenOffice.org

Ralph Krause

Issue #0, linuxjournal.com

The basic OpenOffice applications have built-in HTML functions; here's how to find and use them.

OpenOffice.org is an office suite based on Star Office and released as open source. The suite contains standard office applications, such as a word processor and programs for spreadsheets, drawings and presentations. All of these applications can be used to create web pages, and this article will introduce their HTML capabilities.

Writer

Perhaps the most common application used to create web pages is OpenOffice.org's word processor, Writer. Writer's HTML capabilities include saving existing documents as HTML, creating new documents as HTML and creating several different types of web pages using a wizard.

The easiest way to create HTML documents is to start with an existing Writer document. You can view it as it will appear on a web page by selecting Online Layout from the View menu or by clicking on its toolbar button.

Links can be inserted and modified using the hyperlink editor. Display the editor by clicking on its toolbar button or clicking Hyperlink on the Insert menu. From the Hyperlink window (see Figure 1), you can choose the type of link, as well as specify the link's address, text and how it should be displayed (e.g., in a new window). To edit an existing link or turn existing text into a link, simply highlight it before opening the Hyperlink window. You have to click Apply to insert the link into your document before closing the window.

Hyperlink Window

If you are satisfied with how your document looks in the Online Layout, select Save As from the File menu and specify Web Page as the file type. I saved several files as HTML, including ones with tables, and Writer did a pretty good job with them. One thing that Writer didn't do properly was replace multiple spaces in the original document with the HTML code for non-breaking spaces.

If you have a large document, Writer can save it as a series of HTML files with a table of contents page. To do this, decide which headings in the document should be on separate pages and make sure that they have the same formatting style (e.g., Heading 2). Then select Send on the File menu and click on Create HTML Document. A dialog box will appear allowing you to specify the file name to save the pages under and which style indicates a new page. Click Save to create your multipage HTML document. According to the DOCTYPE tag inserted by OpenOffice.org, the resulting HTML files conform to the HTML 3.2 standard.

In addition, you are not limited to dealing with files that reside on your computer. According to OpenOffice.org's help file, it is possible to specify a fully qualified URL or FTP address in the Open dialog and retrieve a document over a network. I have successfully opened a document using a URL, such as http://www.netperson.net/~rkrause/index.html, but I haven't been able to get the process to work with an FTP address.

When I tried suppling an FTP address a window appeared asking me for my user name followed by an error window. The OpenOffice.org Bugzilla database lists problems with transferring documents using FTP (IDs 3726, 3728), but there is no clear indication it has been fixed. There is also an unanswered letter in the User's forum addressing a problem transferring files with FTP.

OpenOffice.org's wizard, called AutoPilot, allows you to create several types of standard web pages. To use the AutoPilot, click AutoPilot and then Web Page... in the File menu.

A window will open (Figure 2) allowing you to select a template and layout to use. Templates define the structure of the web page, while layouts determine font styles, colors and page background. Some templates included with OpenOffice.org are A list with table of contents, Contact Form, Photo Album and Single column with subheading. The standard template provides a document with a page heading in large text, example links, space for body text and a line indicating when the document was last changed.

Web Page AutoPilot

Changes in the template and layout selections are reflected in the document immediately so you can preview them. Occasionally the document doesn't update properly when a new layout is chosen, but choosing the Empty template and then selecting your original template takes care of this.

You can create a template based on your selections by placing a check in the Create template box. You then can use this template in the future by selecting Templates and Documents under New from the File menu.

Clicking the Create button closes the window and allows you to edit the document. If you elected to create a template, the Templates window will appear where you name your template.

Although Writer does a decent job of converting documents into HTML, there are times when you might have to tweak the code by hand. You edit the document's underlying HTML code by clicking on HTML Source on the toolbar or the View menu.

Calc

The OpenOffice.org spreadsheet, Calc, also can save its files as HTML documents. If the file contains more than one sheet, the additional sheets will follow one another in the HTML file. Links to each sheet will be placed at the top of the document. Calc also allows you to insert links directly into your spreadsheet via the Hyperlink dialog.

Draw

The drawing program allows you to turn your drawings into a series of web pages. These web pages are created by using the Export command from the File menu. Select Web Page as the file type, supply a name for the resulting HTML file and click Save. The HTML Export window will open (Figure 3) allowing you to select whether to use an existing design for your web pages or create a new one.

HTML Export Window

Clicking Next allows you to select the type of web pages to create. The types available are Standard HTML format, Standard HTML with frames, Automatic and WebCast. You also tell OpenOffice.org to create a title page for your presentation if you want one.

Picking Standard HTML generate a series of pages, each page containing one slide. Navigation links are available to move from slide to slide. Selecting Automatic for the publication type generates a series of pages, each with the Refresh meta tag set that causes a browser to automatically cycle through each web page. The final option, WebCast, generates an ASP or Perl application to display your slides. After selecting the type of publication to create, select whether to convert the slides to GIF or JPG files and what resolution should be used.

If you elected to create a title page in the second step above, you supply the information for it on the next page. The title contains an author name, e-mail address and home page, along with any additional information you wish to display.

The next page of the HTML Export wizard allows you to choose between text or graphics for the links used to navigate through the slides. If you opt to use graphical navigation buttons, you can select from several styles to use.

Next you can select the color scheme to use for the web pages. Available schemes include the document's existing scheme, one based upon browser colors or a completely user-defined scheme.

Clicking the Create button generates the HTML files required for your type of publication. The HTML and image files are placed in the same directory, so you might want to create unique directories for each drawing.

Impress

Exporting presentations from OpenOffice.org's Impress application is similar to exporting a drawing from Draw. You use the Export command from the File menu and select Web Page as the file type. The only difference is that you are offered the option to display each slide's notes along with the slide.

Conclusion

OpenOffice.org contains many features to create and edit web pages. Although these applications may not meet the needs of high-level site designers, they offer other users the ability to create decent web pages.

After using the OpenOffice.org applications to edit your web pages, you will have to use other applications to update and maintain your site. OpenOffice.org offers the ability to load web pages by supplying a URL, but I was unable to transfer files over FTP.

Resources

OpenOffice.org

Ralph Krause is a writer, programmer and webmaster who lives in Michigan.

email: rkrause@hetperson.net

LJ Archive