Getting Started Guide

Chapter 12
Creating Web Pages

Saving Documents as HTML Files



Copyright

This document is Copyright © 2010 by its contributors as listed below. You may distribute it and/or modify it under the terms of either the GNU General Public License (http://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0/), version 3.0 or later.

All trademarks within this guide belong to their legitimate owners.

Contributors

Ron Faile Jr.

Feedback

Please direct any comments or suggestions about this document to: documentation@libreoffice.org

Acknowledgments

This chapter is based on Chapter 12 of Getting Started with OpenOffice.org. The contributors to that chapter are:

Agnes Belzunce Peter Hillier-Brook
Ian Laurenson Peter Kupfer
Jean Hollis Weber Linda Worthington

Publication date and software version

Published 30 December 2010. Based on LibreOffice 3.3.

Note for Mac users

Some keystrokes and menu items are different on a Mac from those used in Windows and Linux. The table below gives some common substitutions for the instructions in this chapter. For a more detailed list, see the application Help.

Windows/Linux

Mac equivalent

Effect

Tools Options menu selection

LibreOffice Preferences

Access setup options

Right-click

Control+click

Opens a context menu

Ctrl (Control)

z (Command)

Used with other keys

F5

Shift+z+F5

Opens the Navigator

F11

z+T

Opens the Styles & Formatting window



Contents

Copyright 2

Note for Mac users 2

Introduction 4

Relative and absolute hyperlinks 4

Creating hyperlinks 5

Using the Navigator 5

Using the Hyperlink dialog 6

Editing hyperlinks 8

Removing hyperlinks 8

Saving Writer documents as web pages 8

Saving a document as a single web page 8

Saving a document as a series of web pages 9

Creating web pages using a Wizard 9

Saving Calc spreadsheets as web pages 13

Saving Impress presentations as web pages 13

Saving Draw documents as web pages 17



Introduction

This chapter describes how to do the following in Writer, Calc, Draw and Impress:

When creating a document that you plan to deliver as a web page, you need to consider the following:

Relative and absolute hyperlinks

Hyperlinks stored within a file can be either relative or absolute.

A relative hyperlink says, Here is how to get there starting from where you are now (meaning from the folder in which your current document is saved) while an absolute hyperlink says, Here is how to get there no matter where you start from.

An absolute link will stop working if the target is moved. A relative link will stop working if the start and target locations change relative to each other. For instance, if you have two spreadsheets in the same folder linked to each other and you move the entire folder to a new location, an absolute hyperlink will break but a relative one will not.

To change the way that LibreOffice stores the hyperlinks in your file, select Tools Options Load/Save General and choose if you want URLs saved relatively when referencing the File System, or the Internet, or both.

Calc will always display an absolute hyperlink. Don’t be alarmed when it does this even when you have saved a relative hyperlink—this ‘absolute’ target address will be updated if you move the file.

Note

Make sure that the folder structure on your computer is the same as the file structure on your web server if you save your links as relative to the file system and you are going to upload pages to the Internet.

Tip

When you rest the mouse pointer on a hyperlink, a help tip displays the absolute reference, since LibreOffice uses absolute path names internally. The complete path and address can only be seen when you view the result of the HTML export (saving the spreadsheet as an HTML file), by loading the HTML file as Text, or by opening it with a text editor.

Creating hyperlinks

When you type text (such as a website addresses or URL) that can be used as a hyperlink, and then press the spacebar or the Enter key, LibreOffice automatically creates the hyperlink and applies formatting to the text (usually a color and underlining). If this does not happen, you can enable this feature using Tools AutoCorrect Options Options and selecting the URL Recognition option.

If you do not want LibreOffice to convert a specific URL to a hyperlink, choose Edit Undo Insert from the menu bar or press Control+Z immediately after the formatting has been applied.

Tip

To change the color of hyperlinks, go to Tools Options LibreOffice Appearance, scroll to Unvisited links and/or Visited links, pick the new colors and click OK. Caution: this will change the color for all hyperlinks in all components of LibreOffice; this may not be what you want.

In Writer and Calc (but not Draw or Impress), you can also change the Internet link character style or define and apply new styles to selected links.

You can also insert hyperlinks using the Navigator and the Hyperlink dialog, and you can modify all hyperlinks using the Hyperlink dialog as described in this section.

Using the Navigator

The easiest way to insert a hyperlink to another part of the same document is by using the Navigator:

  1. Open the documents containing the items you want to cross-reference.

  2. Open the Navigator by clicking its icon , by choosing View Navigator, or by pressing F5.

  3. Click the arrow next to the Drag Mode icon, and choose Insert as Hyperlink. (See Figure 1.)

  4. In the list at the bottom of the Navigator, select the document containing the item that you want to cross-reference.

  5. In the Navigator list, select the item that you want to insert as a hyperlink.

  6. Drag the item to where you want to insert the hyperlink in the document. The name of the item is inserted in the document as an active hyperlink.

Frame13

When using the Navigator to hyperlink to an object such as a graphic, to have the hyperlink show useful text such as 2009 Sales Graph, you need to give such objects useful names instead of leaving them as the default names (“Graphics6”), or you need to edit the resulting link text using the Hyperlink dialog, as described below.

You can also use the Navigator to insert a hyperlink from one document (the source) to a specific place in another document (the target). Open the Navigator in the target document and drag the item to the spot in the source document where you want the hyperlink to appear.

Using the Hyperlink dialog

To display the dialog, click the Hyperlink icon on the Standard toolbar or choose Insert Hyperlink from the menu bar. To turn existing text into a link, highlight it before opening the dialog.

Frame1

On the left side, select one of the four categories of hyperlink:

The top right part of the dialog changes according to the choice made for the hyperlink category in the left panel. A full description of all the choices and their interactions is beyond the scope of this chapter. Here is a summary of the most common choices.

For an Internet hyperlink, choose the type of hyperlink (Web, FTP, or Telnet), and enter the required web address (URL).

For a Mail and News hyperlink, specify whether it is a mail or news link, the receiver’s address, and for email, also the subject.

For a Document hyperlink, specify the document path (the Open File button opens a file browser) or leave this blank if you want to link to a target in the same document. Optionally specify the target in the document (for example a specific slide). Click on the Target in Document icon to open the Navigator where you can select the target; or if you know the name of the target, you can type it into the box.

For a New Document hyperlink, specify whether to edit the newly created document immediately (Edit now) or just create it (Edit later), enter the file name, and select the type of document to create (text, spreadsheet, and so on). Click the Select Path button to open a file browser and choose where to store the file.

The Further settings section in the bottom right part of the dialog is common to all the hyperlink categories, although some choices are more relevant to some types of links.

Frame18

Editing hyperlinks

To edit an existing link, click anywhere in the link text and then click the Hyperlink icon on the Standard toolbar or choose Edit Hyperlink from the menu bar. The Hyperlink dialog opens. Make your changes and click Apply. If you need to edit several hyperlinks, you can leave the Hyperlink dialog open until you have edited all of them. Be sure to click Apply after each one. When you are finished, click Close.

The standard (default) behavior for activating hyperlinks within LibreOffice is to use Ctrl+click. This behavior can be changed in Tools Options LibreOffice Security Options, by deselecting the option Ctrl-click required to follow hyperlinks. If clicking in your links activates them, check that page to see if the option has been deselected.

Removing hyperlinks

You can remove the clickable link from hyperlink text—leaving just the text—by right-clicking on the link and selecting Default Formatting. This option is also available from the Format menu. You may then need to re-apply some formatting in order for the text to match the rest of your document.

To erase the link text or button from the document completely, select it and press the Backspace or Delete key.

Saving Writer documents as web pages

Writer’s HTML capabilities include saving existing documents in HTML format, creating new documents as HTML (not described here), 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 get a good idea of how it will appear as a web page by using View Web Layout. However, web layout view will not show you which features will or won’t save correctly to HTML. Some considerations are described in the introduction to this chapter.

Saving a document as a single web page

To save a document as a single web page (HTML format), choose File Save As and specify HTML Document as the file type.

Note

Writer does not replace multiple spaces in the original document with the HTML code for non-breaking spaces. If you want to have extra spaces in your HTML file or web page, you need to insert non-breaking spaces in LibreOffice. To do this, press Control+Spacebar instead of just Spacebar.

Saving a document as a series of web pages

Writer can save a large document as a series of web pages (HTML files) with a table of contents page. To do this:

  1. Decide which headings in the document should start on a new page and make sure all those headings have the same style (for example, Heading 1).

  2. Choose File Send Create HTML Document.

  3. In the Name and Path dialog, type the file name to save the pages under. Also specify which style indicates a new page (as decided in step 1).

  4. Click Save to create the multi-page HTML document. (For those who may be interested, the resulting HTML files conform to the HTML 4 Transitional.)

Frame2

Creating web pages using a Wizard

LibreOffice’s Web wizard allows you to create several types of standard web pages. To use it:

  1. Choose File Wizards Web Page. On the first page of the Wizard, choose settings and click Next. If this is your first web page, the only choice is <default>.

  1. Choose or browse to the document you would like to format. The Title, Summary and Author information is picked up from the document’s properties; if necessary, edit it. Click Next.

  1. Chose a layout for the web site by clicking on the layout boxes. Click Next.

  1. Chose the information to be listed and the screen resolution. Click Next.

  1. Select a style for the page. Use the drop-down list to choose different styles and color combinations. You can browse to a background image and icon set from the Gallery. Click Next.

  1. Enter general information such as Title and HTML Metadata information. Click Next.

  1. Chose where to save the file and preview the page if you wish. Click Finish.

To edit or view the document’s underlying HTML code, open the document, and then choose View HTML Source or click the HTML Source icon on the Main toolbar.

Saving Calc spreadsheets as web pages

Calc can save files as HTML documents. As for Writer, choose File Save As and select HTML Document, or choose File Wizards Web Page.

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 the insertion of links directly into the spreadsheet using the Hyperlink dialog.

Saving Impress presentations as web pages

You can export presentations as Macromedia Flash files: choose File Export and select Macromedia Flash for the file type.

You can also convert presentations into a series of web pages, as described below.

Note

Saving as web pages (HTML format) does not retain animation and slide transitions.

  1. To begin, choose File Export and select HTML Document as the file type.

  2. Create a folder for the files, supply a name for the resulting HTML file, and click Save. The HTML Export Wizard opens.

    Note

    Depending on the size of your presentation and the number of graphics it contains, the HTML export function may create many HTML, JPG, and GIF files. If you simply save to your desktop (not in a specific folder), these separate HTML and graphics files will be all over your desktop. So be sure to create a folder to hold all the files.

  3. Choose the design for all of the pages, either from an existing design or by creating a new one. If you have not previously saved a design, the Existing Design choice is not available.

  1. Click Next to select the type of web pages to create.

  1. Decide how the images will be saved (PNG, GIF, or JPG) and what resolution to use.

When choosing a resolution, consider what the majority of your viewers might be using. If you specify a high resolution, then a viewer with a medium-resolution monitor will have to scroll sideways to see the entire slide, which isprobably not desirable.

  1. If Create title page was chosen in step 4, 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 want to include.

This page of the Wizard does not display if Create title page was not chosen.

  1. Choose the navigation button style to use to move from one page to another. If you do not choose any, LibreOffice will create a text navigator.

  1. Select the color scheme for the web pages. Available schemes include the document’s existing scheme, one based upon browser colors, and a completely user-defined scheme. You can save a new scheme so that it will appear on the first page of the HTML export wizard.

  1. Click Create to generate the HTML files. If this is a new design, a small dialog pops up. If you might want to reuse this design, you can give it a name and save it. Otherwise, click Do Not Save.

Saving Draw documents as web pages

Exporting drawings from LibreOffice’s Draw application is similar to exporting a presentation from Impress. Choose File Export and select HTML Document as the file type.

When using the wizard, you can choose to create the web page at any time by clicking the Create button.