Getting Started Guide
 

Chapter 12  
Creating Web Pages

Saving Documents as HTML Files

Copyright

This document is Copyright © 2010–2016 by the LibreOffice Documentation Team. Contributors are 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/4.0/), version 4.0 or later.

All trademarks within this guide belong to their legitimate owners.

Contributors

Jean Hollis Weber

Peter Schofield

Ron Faile Jr.

Olivier Hallot

 

 

Feedback

Please direct any comments or suggestions about this document to the Documentation Team’s mailing list: documentation@global.libreoffice.org

Note: Everything you send to a mailing list, including your email address and any other personal information that is written in the message, is publicly archived and cannot be deleted.

Acknowledgments

This chapter is adapted and updated from Chapter 12 of Getting Started with OpenOffice.org 3.3. 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 22 June 2016. Based on LibreOffice 5.1.

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 or Linux

Mac equivalent

Effect

Tools > Options menu selection

LibreOffice > Preferences

Access setup options   

Right-click

Control+click and/or right-click depending on computer setup

Open a context menu

Ctrl (Control)

⌘ (Command)

Used with other keys

F5

Shift+⌘+F5

Open the Navigator

F11

⌘+T

Open the Styles and Formatting window

 

Contents

Copyright

Contributors

Feedback

Acknowledgments

Publication date and software version

Note for Mac users

Introduction

Relative and absolute hyperlinks

Creating hyperlinks

Using the Navigator

Using the Hyperlink dialog

Editing hyperlinks

Removing hyperlinks

Exporting web pages using the Web Wizard

Saving and exporting documents as web pages

Writer documents

Single web page

Series of web pages

Calc spreadsheets

Impress presentations

Draw documents

Creating, editing, and saving web pages using Writer/Web

Writer/Web display modes

Creating and editing an HTML document

Checking a web page in a browser

 

Introduction

HTML capabilities in LibreOffice include saving and exporting existing documents in HTML format.

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

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. Do not 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.

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.

When you rest the mouse pointer on a hyperlink, a help tip displays the absolute reference, because 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 by going to Tools > AutoCorrect Options > Options on the menu bar and selecting the URL Recognition option.

If you do not want LibreOffice to convert a specific URL to a hyperlink, go to Edit > Undo Insert on the menu bar, or press Ctrl+Z immediately after the formatting has been applied, or place the cursor in the hyperlink, right-click, and select Remove Hyperlink from the context menu.

To change the color of hyperlinks, go to Tools > Options > LibreOffice > Application colors, 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.

Using the Navigator

You can insert hyperlinks using the Navigator and this is an easy way to insert a hyperlink to another part of the same document.

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

  2. 2)Click on the Navigator icon in the Sidebar or press F5. 

  3. 3)Click the triangle to right of the Drag Mode icon and select Insert as Hyperlink (Figure 1). Note that the Drag Mode icon changes shape depending on the type of insert that was previously selected. The default icon for Drag Mode is to show the Hyperlink icon . 
 

Figure 1: Inserting hyperlink using the Navigator

 
  1. 4)Select the document from the drop-down list at the bottom of the Navigator that contains the item that you want to link to. 

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

  3. 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. 

When using the Navigator to insert a hyperlink to an object such as a graphic, it is recommended to have the hyperlink show a useful name, for example 2009 Sales Graph. You need to give such objects useful names instead of leaving them as the default names, for example Graphics6, or you will have to edit the name of the resulting link 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 position in the source document where you want the hyperlink to appear.

Using the Hyperlink dialog

You can use the Hyperlink dialog to insert a hyperlink and modify all hyperlinks.

  1. 1)Highlight the existing text you want to use as a link. 

  2. 2)Click the Hyperlink icon on the Standard toolbar or go to Insert > Hyperlink on the menu bar to open the Hyperlink dialog (Figure 2). 

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

  1. 4)The Hyperlink dialog changes depending on the type of hyperlink selected. Enter all necessary details to create the hyperlink. 

  2. 5)Click Apply to create the hyperlink and the Hyperlink dialog remains open allowing you to create another hyperlink. 

  3. 6)Click Close to close the Hyperlink dialog. 

 

Figure 2: Hyperlink dialog showing details for Internet links

 

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.

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.

Editing hyperlinks

To edit an existing link:

  1. 1)Click anywhere in the hyperlink text. 

  2. 2)Click the Hyperlink icon on the Standard toolbar, or go to Edit > Hyperlink on the menu bar, or right-click and select Edit Hyperlink from the context menu. The Hyperlink dialog opens. 

  3. 3)Make your changes and click Apply to save your changes. The Hyperlink dialog remains open, allowing you to continue editing hyperlinks. Click Apply after editing each hyperlink. 

  4. 4)When you are finished editing hyperlinks, 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 link from hyperlink text and leave just the text by right-clicking on the link and selecting Remove Hyperlink from the context menu. You may then need to re-apply some formatting to match the text with 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.

Exporting web pages using the Web Wizard

You can use the Web Wizard to create several types of standard web pages from all LibreOffice components except Math. Each time you start the Web Wizard in a LibreOffice component, Writer automatically starts before the Web Wizard opens. The Web Wizard is linked to Writer and is normally used in Writer for creating web pages.

  1. 1)Go to File > Wizards > Web Page on the menu bar to open the Web Wizard dialog. 

 

Figure 3: Introduction page of Web Wizard dialog

 
  1. 2)On the first page of the Wizard, choose settings and click Next >. If this is your first web page, the only choice is <default>. 

  2. 3)Select or browse to the document you would like to format. The information for Title, Summary and Author is taken from the document properties. If necessary, edit this information (Figure 4). 

 

Figure 4: Documents page of Web Wizard dialog

 
  1. 4)Click Next > and select a layout for the web site by clicking on the layout boxes (Figure 5). 

 

Figure 5: Main layout page of Web Wizard dialog

 
  1. 5)Click Next > to customize the layout and select the information to be listed and screen resolution (Figure 6). 

 

Figure 6: Layout details page of Web Wizard dialog

 
  1. 6)Click Next > and select a style for the page. Use the drop-down list to choose different styles and color combinations. Browse to select a background image and icon set from the Gallery (Figure 7). 

  2. 7)Click Next > and enter general information for the web site, such as Title and HTML Metadata information (Figure 8). 

  3. 8)Click Next > and enter the information of where to publish your new web site (Figure 9). 

  4. 9)Click Finish to save the file and close the Web Wizard. 

 

Figure 7: Style page of Web Wizard dialog

 
 

Figure 8: Web site information page of Web Wizard dialog

 
 

Figure 9: Preview page of Web Wizard dialog

 

Saving and exporting documents as web pages

The easiest way to create HTML documents in LibreOffice is to start with an existing 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 does not show you which features will or will not be saved correctly in HTML format. Refer to “Relative and absolute hyperlinks” on page 4 on what to consider before creating a web page from a document.

Writer documents

Single web page

To save a document as a single web page (HTML format), go to File > Save As on the menu bar and specify HTML Document (Writer) as the file type or File > Export and specify XHTML format as the file type.

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 Ctrl+Spacebar instead of just Spacebar.

Series of web pages

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

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

  2. 2)Go to File > Send > Create HTML Document on the menu bar to open the Name and Path of the HTML Document dialog (Figure 10). 

 

Figure 10: Creating a series of web pages from one document

 
  1. 3)Type the file name to save the pages under. 

  2. 4)Specify which style indicates a new page by using the Styles drop-down list at the bottom of the dialog (for example, Heading 1). 

  3. 5)Click Save to create the multi-page HTML document. The resulting HTML files conform to the HTML 4 Transitional standard. 

Calc spreadsheets

Calc can save files as HTML documents by going to File > Save As on the menu bar and select HTML Document (Calc) format as the file type. This is similar to “Single web page” above.

If the file contains more than one sheet and the web pages are created using the Web Wizard (see “Exporting web pages using the Web Wizard” on page 8), 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. See “Creating hyperlinks” on page 5 for more information on hyperlinks.

Impress presentations

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

Impress presentations cannot be saved in HTML format, but have to be exported as HTML documents. Note that you can click Create at any step in the following procedure. The web pages created will then use the default settings that you have not changed in any way.

  1. 1)Go to File > Export on the menu bar and specify the file name and location of where to save the web page version of your presentation. 

  2. 2)Select HTML document (Impress) as the file type and click Save to open the HTML Export dialog (Figure 11). 

 

Figure 11: HTML Export dialog - Assign design page

 
  1. 3)On the Assign design page, you can choose to create a new design and select or delete an existing design. Specify a New design or an Existing design and click Next >>. If you have not previously saved a web page design, the Existing Design choice is not available.  

  1. 4)Specify the Publication type for the web pages (Figure 17), then click Next>>. The publication type defines the basic settings for the intended export. The choices are: 

For more information on the options available for this page of the HTML Export dialog, click Help to open the help pages.

 

Figure 12: HTML Export dialog – Publication type page

 
  1. 5)Specify the options for Save graphics as, Monitor resolution, and Effects used for the web pages (Figure 13), then click Next>>. The options for this page of the HTML Export dialog are as follows: 

For more information on the options available for this page of the HTML Export dialog, click Help to open the help pages.

 

Figure 13: HTML Export dialog – graphics and monitor resolution

 
  1. 6)Specify the Information for the title page to be used with the web version of your presentation (Figure 14). The title page normally contains the author’s name, an e-mail address and home page, along with any additional information you may want to include. This page is not available if you have selected not to create a title page and either Automatic or WebCast publication type. 

 

Figure 14: HTML Export dialog – title page information

 
  1. 7)Select Link to a copy of the original presentation if you want to create a hyperlink to download a copy of the presentation file and then click Next>>. 

  2. 8)Select button style to be used for the web pages from the designs available (Figure 15) and then click Next>>. 

If you do not select a button style, LibreOffice will create a text navigator.

This page is not available if you have selected either Automatic or WebCast publication type.

 

Figure 15: HTML Export dialog – button style page

 
  1. 9)Select color scheme to be used for the web pages (Figure 16) such as the color scheme and colors for text and background. This page is not available if you have selected either Automatic or WebCast publication type. 

 

Figure 16: HTML Export dialog – color scheme page

 
  1. 10)Click Create. 

  2. 11)If you have created a new design for your web pages, type in a name for your design and click Save. 

Depending on the size of your presentation and the number of graphics it contains, the HTML export function creates several HTML, JPG, and GIF files. It is recommended to create a folder to hold all the files created for the web version of your presentation. If you simply save to your desktop and not in a specific folder, these separate HTML and graphics files will be placed all over your desktop.

Draw documents

Draw documents cannot be saved in HTML format, but have to be exported as HTML documents. Exporting drawings as web pages from Draw is similar to exporting a presentation from Impress. Go to File > Export and select HTML Document (Draw) as the file type, then follow the procedure above for exporting Impress presentations.

Creating, editing, and saving web pages using Writer/Web

LibreOffice Writer can create, edit, and save web pages in HTML format using a configuration called Writer/Web.

 
 

Writer/Web display modes

In addition to the Normal and Web display modes for editing (Figure 17), Writer/Web has a third editing mode called HTML Source mode (Figure 18). With the HTML Source mode, you can directly edit HTML tags such as <p>, <ul>, <table>  and so on to compose web page elements. In that mode you must know the HTML markup language.

 
 

You normally add content to an HTML document using the Web display mode, because it will render the contents as if displayed in a browser. Use the HTML Source editing mode to tweak the formatting.

Because HTML markup language has fewer formatting possibilities than a text document in OpenDocument Format, Writer/Web cannot provide all formatting features for HTML documents and some formatting dialogs have fewer options available. For example, an HTML paragraph has no tab settings.

Creating and editing an HTML document

To create an HTML document, choose File > New > HTML Document. Writer/Web opens a blank document in web display mode. You can now add content to the document by typing or pasting text, images, tables, and other objects. Use all the Writer/Web formatting resources including styles to format the content. When you have finished, save the document with the HTML file type.

If you need to add HTML content directly into the document, enter HTML Source editing mode by clicking the HTML Source icon on the toolbar or choosing View > HTML Source from the menu bar. In that mode, Writer/Web turns into a notepad-like text editor (Figure 18).

The HTML markup content generated by Writer/Web is limited to the production of a displayable document in a web browser. It does not consider other components of a website such as external cascading style sheets (CSS), external javascript, or other script languages. Use the HTML Source mode to manually insert links to these external components into the page.

Checking a web page in a browser

It is important to check your web pages (HTML documents) in a web browser such as Mozilla Firefox, Google Chrome, Microsoft Edge, or Safari. Not all browsers render HTML files the same way, so if possible, check the contents in several browsers.

To make LibreOffice open your default web browser and display the contents of a document, go to File > Preview in Web Browser. You can also open any web browser and then open the HTML file in it.