LibreOffice Logo

Writer Guide 24.2

Chapter 13, Tables

Copyright

This document is Copyright © 2024 by the LibreOffice Documentation Team. Contributors are listed below. This document may be distributed and/or modified under the terms of either the GNU General Public License (https://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0/), version 4.0 or later. All trademarks within this guide belong to their legitimate owners.

Contributors

To this edition

Jean Hollis Weber

 

 

To previous editions

Jean Hollis Weber

Kees Kriek

Gillian Polack

Bruce Byfield

John A Smith

Barbara Duprey

Shravani Bellapukonda

Ron Faile Jr.

 

Feedback

Please direct any comments or suggestions about this document to the Documentation Team Forum at https://community.documentfoundation.org/c/documentation/loguides/ (registration is required) or send an email to: loguides@community.documentfoundation.org.

Note

Everything sent to a forum, including email addresses and any other personal information that is written in the message, is publicly archived and cannot be deleted. Emails sent to the forum are moderated.

Publication date and software version

Published February 2024. Based on LibreOffice 24.2 Community.Other versions of LibreOffice may differ in appearance and functionality.

Using LibreOffice on macOS

Some keystrokes and menu items are different on macOS from those used in Windows and Linux. The table below gives some common substitutions used in this document. For a detailed list, see LibreOffice Help.

Windows or Linux

macOS equivalent

Effect

Tools > Options menu selection

LibreOffice > Preferences

Access setup options

Right-click

Control+click or right-click depending on computer setup

Open a context menu

Ctrl (Control)

(Command)

Used with other keys

Alt

⌥ (Option) or Alt

Used with other keys

F11

+T

Open Styles deck in Sidebar

Introduction

Tables are a useful way to organize and present large amounts of information, for example:

Tables can often be used as an alternative to spreadsheets to organize materials. A well-designed table can help readers understand better what you are saying. While you would normally use tables for text or numbers, you could put other objects, such as pictures, in cells. Writer’s tables provide limited spreadsheet functions; see “Using spreadsheet functions in a table” on page 1.

Tables can also be used as a page-layout tool to position text in areas of a document instead of using several Tab characters. Another example is in headers and footers to support independent positioning of different elements, such as page number, document title, and so on. This use of tables is described in Chapter 6, Formatting Pages: Advanced.

Tools for working with tables

All of the table commands described in this chapter are conveniently located under Table on the Menu bar (Figure 1) and on the Table toolbar (Figure 2). Some are also found in the context menu for a table or in the Table panel of the Properties deck in the Sidebar (Figure 3).

Figure 1: Table menu

Table menu

When you create a table or select an existing table, the Table toolbar (Figure 2) is displayed automatically. To display it at any time, click View > Toolbars > Table. The toolbar can float over the main Writer window, or it can be docked along any edge of the main window. See Chapter 1, Introducing Writer, for more about docking and floating toolbars, and how to hide and display specific tools on a toolbar.

Percent
2
Insert rows below
13
Optimize Size
24
Number Format: Decimal
3
Insert columns before
14
Align Top
25
Number Format
4
Insert columns after
15
Center Vertically
26
Insert Caption
5
Delete selected rows
16
Align Bottom
27
Sort
6
Delete selected columns
17
Table Cell Background Color
28
Protect Cells
7
Delete table
18
AutoFormat Styles
29
Unprotect Cells
8
Select Cell
19
Borders
30
Sum
9
Select Table
20
Border Style
31
Insert or Edit Formula
10
Merge Cells
21
Border Color
32
Table Properties
11
Split Cells
22
Number Format: Currency


Figure 2: Table toolbar

1

Insert rows above

12

Split Table

23

Number Format: Percent

2

Insert rows below

13

Optimize Size

24

Number Format: Decimal

3

Insert columns before

14

Align Top

25

Number Format

4

Insert columns after

15

Center Vertically

26

Insert Caption

5

Delete selected rows

16

Align Bottom

27

Sort

6

Delete selected columns

17

Table Cell Background Color

28

Protect Cells

7

Delete table

18

AutoFormat Styles

29

Unprotect Cells

8

Select Cell

19

Borders

30

Sum

9

Select Table

20

Border Style

31

Insert or Edit Formula

10

Merge Cells

21

Border Color

32

Table Properties

11

Split Cells

22

Number Format: Currency

 

 

Figure 2: Table toolbar

When the cursor is in a table, the Properties deck in the Sidebar (Figure 3) includes table properties.

Figure 3: Table properties in the Sidebar

Table properties in the Sidebar

Creating a table

Before creating a table in a Writer document, it helps to have an idea of the visual result wanted and an estimate of the number of rows and columns required. Every parameter can be changed at a later stage; however, thinking ahead can save time as changes to fully formatted tables often require a significant effort.

Creating a new table

To quickly create a table with the default properties, click the Insert Table icon on the Standard toolbar. On the drop-down graphic, choose the size of the table (up to fifteen rows and up to ten columns). To create the table, click the cell that you want to be on the last row of the last column.

Figure 4: Inserting a table

Inserting a table

To create a new table and specify the properties for the table, position the cursor where you want the table to appear, then use any of these methods to open the Insert Table dialog (Figure 5):

In the General section of the Insert Table dialog, in the Name box, you can enter a different name from the Writer-generated default for the table. This might come in handy when using the Navigator to jump quickly to a table.

In the Columns and Rows boxes, specify the number of columns and rows for the new table. You can change the size of the table later, if necessary.

Figure 5: Insert Table dialog

Insert Table dialog

Under Options, set up the initial table characteristics:

The default Table Heading paragraph style is applied to the heading rows. You can edit the Table Heading paragraph style to change these default settings.

The Styles section lists several predefined table layouts, also known as table styles. See “Creating and applying table styles” on page 1 for more information. You can select and preview the desired table option from the list.

After making your choices, click Insert. Writer creates a table as wide as the text area (from the left page margin to the right page margin), with all columns the same width and all rows the same height. You can adjust the columns and rows later to suit your needs.

Creating nested tables

You can create tables within tables, nested to a depth limited only by imagination and practicality. Nested tables are especially useful for page layout. Figure 6 demonstrates a simple, two-level example. The shaded table is inside a cell of the larger table. To achieve this, simply click in a cell of an existing table and use any of the methods mentioned in “Creating a new tableabove.

Figure 6: Nested table example

Nested table example

Using AutoCorrect to create a table

You can also create a table by typing a series of hyphens (-) or tabs separated by plus signs. Use the plus signs to indicate column dividers, while hyphens and tabs are used to indicate the width of a column. When using tabs, the default tab setting determines the width; this setting can be changed in Tools > Options > LibreOffice Writer > General.

For example, this character sequence:

+-----------------+---------------+------+

creates a table like this:

Table created by AutoCorrect

Note

This function can be disabled or enabled in Tools > AutoCorrect > AutoCorrect Options. On the Options page, deselect or select Create table.

Creating a table from formatted text

To create a table from formatted text, select the text, then choose Table > Convert > Text to Table on the Menu bar. The text to be converted must contain characters to indicate column separators. Paragraph marks indicate an end of a table row.

Tip

Unlike the creation of a table by other methods, conversion from text to table preserves the paragraph style and character style applied to the original text.

1)  Start by editing the text, if necessary, to ensure the column separator character is where you want it. Select the text to be converted and choose Table > Convert > Text to Table to open the dialog shown in Figure 7.

2)  The Separate text at section has four options for the separator for the columns of text. Select Other to choose the default comma (useful if you are importing a .csv file) or type any character in the box.

  1. The Options are the same as those in the Insert Table dialog (Figure 5).

3)  Click OK to convert the text.

Figure 7: Convert Text to Table dialog

Convert Text to Table dialog

Example

In this example we will convert the following text into a table.

Row 1 Column 1; Row 1 Column 2; Row 1 Column 3

Row 2 Column 1; Row 2 Column 2; Row 2 Column 3

In this case, the separator between elements is a semicolon. Select the text and choose Table > Convert > Text to Table. We obtain the following result.

Tip

Result of converting text to a table

You can also convert a table into plain text. This may be useful when you want to export the table contents into a different program. Place the cursor anywhere in the table, choose Table > Convert > Table to Text on the Menu bar, pick the preferred row separator, and click OK to finish.

Inserting a portion of a spreadsheet

To copy a spreadsheet area into a Writer document as a Writer table:

1)  Open both the Writer document and the spreadsheet.

2)  Select the sheet area (cells) that you want to copy.

3)  Right-click and choose Copy in the context menu, or press Ctrl+C; then click in the Writer document and choose Paste in the context menu or press Ctrl+V. Or, drag the area into the Writer document.

See also Chapter 19, Spreadsheets, Charts, Other Objects, for other methods of inserting spreadsheets into Writer documents.

Formatting the table layout

Formatting a table is a two-step process: formatting the table layout (the subject of this section) and formatting the table text (the subject of the next section).

Tip

If you apply similar formatting of table layout and table text to multiple tables, using table styles can speed up your work and provide consistency. See “Creating and applying table styles” on page 1.

Formatting the layout involves one or more of the following operations: adjusting the size of the table and its position on the page, adjusting sizes of rows and columns, adding or removing rows or columns, merging and splitting individual cells, changing borders and background.

Default parameters

If you create a table using the Insert Table dialog or the Insert Table icon on the Standard toolbar, the following defaults are set:

Resizing and positioning the table

To quickly resize a table, first move the mouse pointer to either the left or right edge. When the pointer changes shape, drag the border to the new position. This method only changes the size of the first or last column; it does not change the alignment of the table on the page.

For more precise control over the size and position of the table on the page, use the Table Properties dialog (Figure 8). Choose Table > Properties on the Menu bar, or right-click anywhere in the table and choose Table Properties in the context menu, or click the More Options icon in the Table panel of the Properties deck on the Sidebar.

Figure 8: Table Properties dialog, Table tab

Table Properties dialog, Table tab

On the Table tab of the dialog (Figure 8), you can set the alignment of the table:

Selecting an alignment option other than Automatic activates the Width field in the Properties section, where you can enter the desired size of the table. Select Relative to see the width as percentage of the text area.

In the Spacing section, use the Above and Below boxes to modify the separation between the text and the table.

When the size of the table is less than the size of the text area, Writer will insert some values in the Left and Right boxes. Otherwise these values are not available. You can enter values:

Specifying text flow

On the Text Flow tab of the Table Properties dialog (Figure 9), you can:

Note

A table heading row cannot span two pages, but any other row can. A one-row table (often used for page layout purposes), if set up with the default of including a heading, will not break across pages. The solution is to make sure the table is defined without a heading row.

Figure 9: Table Properties dialog, Text Flow tab

Table Properties dialog, Text Flow tab

Resizing rows and columns

You can adjust the height of rows and the width of columns in a table in several ways.

Selecting Table > Size on the Menu bar also offers some resizing options:

For greater control over the width of each column, use the Columns tab of the Table Properties dialog (Figure 10).

Figure 10: Table Properties dialog, Columns tab

Table Properties dialog, Columns tab

Right-click on the table and choose Table Properties in the context menu, or choose Table > Properties on the Menu bar, or click the More Options icon in the Table panel of the Properties deck on the Sidebar. On the Table Properties dialog, select the Columns tab.

Tip

Rather than starting from the Table Properties dialog, it is often more efficient to make rough adjustments to a new table using the mouse, and then fine-tune the layout using the Columns tab and the Table tab of the Table Properties dialog.

You can also resize a table using the keyboard:

1)  Place the cursor in the cell where you want to make changes.

2)  Press and hold the Alt key while using the arrow keys.

To adjust the resizing parameters and behavior for keyboard handling, choose Tools > Options > LibreOffice Writer > Table (Figure 11).

Figure 11: Choosing keyboard handling of table columns and rows

Choosing keyboard handling of table columns and rows

Use the Row and Column values in the Move cells section to determine the amount of change produced by a single keystroke while resizing. In the Behavior of rows/columns section, you can choose one of three strategies when resizing:

Inserting rows and columns

To quickly insert one row or column, place the cursor in the row or column before or after which you want to add new rows or columns, and then do one of the following:

To insert any number of rows or columns:

1)  Place the cursor in the row or column where you want to add new rows or columns.

2)  Choose Table > Insert > Rows or Table > Insert > Columns on the Menu bar, or right-click and choose Insert > Rows or Insert > Columns in the context menu.

3)  In the small dialog that opens, select the number of rows or columns to add, and whether they appear before or after the one selected. Set Number to the number of rows or columns to insert, and Position to Before or After.

4)  Click OK to close the dialog.

Note

Regardless of how they are inserted, new rows or columns have the same formatting as the row or column where the cursor was located.

Deleting rows and columns

To quickly delete one or more rows or columns, select the rows or columns you want to delete and do one of the following:

Merging and splitting cells

A common use for merging cells is to make a heading row that takes up the entire width of the table, or a subheading row over more than one column.

To merge a cell or group of cells into one cell:

1)  Select the cells to merge.

2)  Right-click and choose Merge Cells in the context menu, or choose Table > Merge Cells from the Menu bar, or click the Merge Cells icon on the Table toolbar or the Table panel of the Properties deck on the Sidebar. Any content of the cells appears in the merged cell.

To split a cell into multiple cells:

1)  Position the cursor inside the cell.

2)  Right-click and choose Split Cells in the context menu, or choose Table > Split Cells on the Menu bar, or click the Split Cells icon on the Table toolbar or the Table panel of the Properties deck on the Sidebar.

3)  On the Split Cells dialog, select how to split the cell and how many cells to create. A cell can be split either horizontally (create more rows) or vertically (create more columns).

Figure 12: Split Cells dialog

Split Cells dialog

It is generally best to merge and split cells after completing other layout formatting. This is because some operations such as deleting a column or a row may produce a result difficult to predict when applied to a table with merged or split cells.

Specifying table borders

To quickly apply some table borders, use the palette of options on the Borders, Border Style, and Border color icons in the Table toolbar or the Table panel of the Properties deck on the Sidebar. For more control, use the Borders tab of the Table Properties dialog (Figure 13).

Figure 13: Table Properties dialog, Borders page

Table Properties dialog, Borders page

Note

When the selected cells have different styles of border, the User-defined area shows the border as a gray line. Click the gray line to choose a new border style (first click), leave the border as it is (second click) or delete the border (third click).

Tip

To reset everything on the Borders tab of the Table Properties dialog, select the No Borders icon under Line arrangement Presets (the box on the left).

Selecting background colors and images

A table background can greatly improve the readability of data, visually highlight important parts of the table (such as the heading or a specific cell), or just make the table more appealing. You can choose between two types of background: solid color or image. The background can be applied to the whole table, to a single cell, or to a row.

You can quickly apply color cell backgrounds using the palette of options on the Table Cell Background Color icon in the Table toolbar or the Table panel of the Properties deck on the Sidebar. For more control, or to use an image as a background, use the Background tab of the Table Properties dialog (Figure 14).

Figure 14: Table Properties dialog: inserting an image as a background

Table Properties dialog: inserting an image as a background

Tip

Consider the color contrast between the background and foreground (usually text). Background colors and images can also have transparency applied to help make the text more readable. The row background option is quite handy for creating alternate color rows or assigning a different background to the heading of the table.

Note

The background selected for a cell will be in front of the row background which in turn will be in front of (and hide) the table background.

To set the background for a cell, row, or table:

1)  Place the cursor anywhere inside the cell, row, or table to work with. To apply a background to a group of cells, select the group.

2)  Right-click and choose Table Properties in the context menu, or choose Table > Properties on the Menu bar, or click the More Options icon on the Table panel of the Properties deck on the Sidebar.

3)  In the Table Properties dialog, select the Background tab (Figure 14).

4)  Choose whether to apply the settings to cell, row, or table.

5)  To apply a color, click the Color button, select the color, and click OK.To apply an image, click the Image button, then,

a)  Select from the given images or use the Add/Import button.

b)  Under Options, select the type of placement for the image.Style – the way the image is to appear: custom position/size, tiled, or stretched.Size – the required Image aspect ratio or the Scale option.Positionwhere the image is to be displayed.

c)  To apply the image, click OK.

Displaying or hiding table boundaries

A table boundary is a set of pale (usually gray) lines around the cells when viewed on‑screen in LibreOffice with no borders enabled. These boundaries are not printed; their only function is to show where the table cells are. They are particularly useful when using tables for page layout.

To display tables the same way on the screen as on the printed page, with no boundary lines, deselect View > Table Boundaries, or go to Tools > Options > LibreOffice > Application Colors, where you can display or hide boundaries around text, tables, headers and footers, figures, and other parts of a document, and you can choose the color of boundary lines.

Turning boundaries off does not hide any borders that the table may have.

Creating and applying table styles

Using table styles, you can apply an elaborate format to your table with just a few clicks. Like other styles, table styles enable you to produce consistent looking tables in a document.

Applying a table style

To apply a table style, go to the Table Styles tab of the Styles deck on the Sidebar. Then place the cursor anywhere in the table and double-click the name of a style.

For more control, go to Table > AutoFormat Styles on the Menu bar, or click the AutoFormat Styles icon on the Table toolbar. On the AutoFormat dialog (FIgure Figure 15), select a format from the list, choose which features you wish to use in your table (font, alignment, borders, and so on), and then click OK. The table will be reformatted.

Figure 15: AutoFormat dialog

AutoFormat dialog

Tip

You can rename the formats by selecting one and clicking the Rename button. The name will change in this dialog and in the Table Styles page on the sidebar.

You can delete a format by selecting it and clicking the Delete button. However, you cannot rename or delete the Default Table Style.

Creating a table style

Although the Table Styles tab of the Sidebar’s Styles deck includes a quick way to apply table styles, they are created by using the AutoFormat feature. Follow these steps:

1)  Create a table. Format it as you wish: font, alignment, borders, background, number format.

2)  Put the cursor anywhere in the table. Select Table > AutoFormat Styles on the Menu bar, or click the AutoFormat Styles icon on the Table toolbar.

3)  On the AutoFormat dialog (Figure 15), choose which formatting to include in the new table style, and then click Add.

4)  In the pop-up dialog, type a name for the new style and click OK. The new style is added to the list of formats in the AutoFormat dialog and to the list of table styles in the Styles deck in the sidebar.

Table styles also include the following table-level properties:

Tip

These styles do not include table and column widths in the table format. To insert a table with predefined full formatting, save it as AutoText. See Chapter 2, Working with Text: Basics, for instructions.

Formatting the table text

Once the table layout is set, you can move on to formatting the text in the individual cells. You can apply manual formatting as with any other paragraph in the text, but it is highly recommended that you use paragraph and character styles, for consistency and ease of maintenance. Other aspects to consider include text flow, alignment, and orientation.

You can format each cell independently of other cells, or you can simultaneously format a group of cells by selecting them before applying the desired formatting.

Tip

You can apply basic table text formatting by choosing a table style and then modify only those cells that you wish to be different.

Vertical alignment

By default, text entered into a table is aligned to the top-left of the cell. You can change the default for the entire table, as described above, or for individually selected cells.

To vertically align the text in specific cells:

1)  Place the cursor in the cell you wish to change, or select multiple cells.

2)  Click an icon on the Table toolbar: Align Top, Center Vertically, or Align Bottom.

Number formats

The number format can be set for a whole table, a group of cells, or a single cell. For example, cells can be set to display in a particular currency, to four decimal places, or in a particular date format.

Number recognition specifies that numbers in a text table are recognized and formatted as numbers. If Number recognition is not selected, numbers are saved in text format and are automatically left-aligned. To enable Number recognition, go to Tools > Options > LibreOffice Writer > Table and select the option in the Input in Tables section.

To set the number format for one or more cells, select the cells, then either click the icon for one of the popular formats on the Table toolbar, or choose Table > Number Format on the Menu bar. On the Format Number dialog (Figure 16), you can set options for various categories of numerical data.

Tip

Writer displays the formatting code for the category and format selected in Format Code section at the bottom of the dialog. For example, if you select a date format such as 31 Dec 1999 the corresponding code is D MMM YYYY. Advanced users can easily customize this formatting code as well as create new user-defined codes.

Figure 16: Format Number dialog

Format Number dialog

Rotating text in a table cell

You can rotate text in a table cell by 90 or 270 degrees. Text rotation can be useful when you have long headings for narrow columns.

Note

Text rotation within table cells can also be achieved with the use of paragraph styles, discussed in Chapter 9, Working with Styles.

Data entry and manipulation in tables

Moving between cells

To move between cells within a table, use the mouse, the arrow keys, or the Tab key.

The arrow keys move the cursor one text character left or right at a time. If a cell is empty, pressing the arrow key moves the cursor to the adjacent cell.

The Tab key moves directly to the next cell and, if the cursor is in the last cell in the table, creates a new row. Pressing Shift+Tab moves the cursor back a cell.

Tip

To enter a Tab character as part of the text of the cell, press the Ctrl and Tab keys at the same time.

To move to the beginning of the table, press Ctrl+Home. If the active cell is empty, the move is to the beginning of the table. If the cell has content, the first press goes to the beginning of the cell and the next press goes to the beginning of the table. (Pressing again goes to the beginning of the document.)

To move to the end of the table, press Ctrl+End. If the active cell is empty, the move is to the end of the table. If the cell has content, the first press goes to the end of the cell and the next press goes to the end of the table. (Pressing again goes to the end of the document.)

Sorting data in a table

Just as in a spreadsheet, data in a table can be sorted. You can specify up to three levels of sorting (for example, sort first by age numerically, then alphabetically by name within each age).

To sort data in a table:

1)  Select the table (or part of the table) to be sorted.

2)  Choose Table > Sort on the Menu bar, or click the Sort icon on the Table toolbar.

3)  In the Sort dialog (Figure 17):

a) Decide whether you want to sort in the direction of rows or columns. The default sorting direction is by rows, which results in sorting the data in a column.

b) Select up to three keys to sort on, in the correct order.

c) For each key, select which column or row to sort on, whether the sort is Numeric or Alphanumeric and whether it is Ascending or Descending.

d) Click OK to perform the sort.

Figure 17: Selecting criteria for sorting

Selecting criteria for sorting

Note

Be sure to select all cells that might be affected by the sorting. For example, if you select only the cells of one column, the sort affects that column only, while the others remain unchanged. In such a case, you risk mixing the data of the rows.

Using spreadsheet functions in a table

For many simple mathematical functions, Writer tables can be used as basic spreadsheets. Just as in a spreadsheet, each table cell is identified by a letter (for the column) and a number (for the row). For example, cell C4 is the cell in the third column from the left and fourth row from the top. When the cursor is in a cell, the table name and this cell reference is displayed on the status bar.

Tip

Basic spreadsheet functions in tables are much the same as in LibreOffice Calc. The main difference is that cell references are formatted differently. Cell A2 (first column, second row) is referred to in Calc as A2 (or $A$2 for an absolute reference). In Writer tables, it is referred to as <A2>.

For example, suppose you had two numbers in cells <B1> and <C2> and wanted to display the sum of the two in cell <A1>, as shown in Figure 18.

Do the following to sum up 4 and 5:

  1. Click in cell <A1> and press the = key, or choose Table > Formula on the Menu bar, or press F2, or click the Sum icon or the Formula icon on the Table toolbar, or click the Formula icon in the Table panel of the Properties deck on the Sidebar.

    The Formula bar appears automatically at the top of the workspace. In the leftmost side of the bar, you can see the coordinates of the selected cell.

  2. Click in cell <B1>. The identifiers of this cell are automatically displayed in the Formula bar and inserted into cell <A1>.

  3. Press the + key.

  4. Click in cell <C2>. You can see the final formula = <B1>+<C2> displayed both in the selected cell and on the Object bar.

  5. Press the Enter key, or click the green check mark (may be a different symbol on some installations) on the Formula Bar, to replace the formula in the cell with the result of the calculation.

Figure 18: Using spreadsheet functions in a table

Using spreadsheet functions in a table

Tip

To display a cell's formula and make it available for editing, choose Table > Formula on the Menu bar, or use one of the other methods above.

To display the list of the mathematical functions available for use in a table, display the Formula toolbar and then click the Formula f(x) icon.

In our example, this gives the result 9 in the top left cell. For summing contiguous cells, you can simply select the cells in the row, column, or the rectangle of rows and columns. Thus, for example, to add a column of numbers, do this:

1)  Type an equals sign = in an empty cell.

2)  Select the cells to be added together, in this case the cells from A2 to A5. The formula should be something like =<A2:A5>.

3)  Press the Enter key or click the green check mark on the Formula Bar.

4)  The result appears in the empty cell where you entered the formula.

When using a function, you can type the cell references manually or select them. Thus, to add up the four numbers that we added above (A2, A3, A4, A5), do this:

1)  Type an equals sign = in an empty cell.

2)  Type sum or select it from the function list f(x).

3)  Select the contiguous cells to be added together. The formula should be something like =sum<A2:A5>.

4)  Press the Enter key or click the green check mark on the Formula Bar. The answer appears in the empty cell where you entered the formula.

Caution

In Writer, formulas are not updated automatically when inserting or deleting rows or columns of the table, although the results do update when a value is changed in a cell. To use complex formulas, consider embedding a Calc spreadsheet in the Writer document. See Chapter 19, Spreadsheets, Charts, Other Objects.

Additional table operations

Protecting cells in a table

You can protect the contents of individual cells of a table from changes. When a cell is protected, most of the menu items and toolbar icons are inactivated.

Note

This protection is not intended for secure protection. It protects the cells against accidental changes.

To turn on cell protection, place the cursor in a cell or select cells, then click the Protect Cells icon on the Table toolbar or choose Table > Protect Cells on the Menu bar.

To tun off cell protection, place the cursor in the cell or select the cells. Then click the Unprotect Cells icon on the Table toolbar or choose Table > Unprotect Cells on the Menu bar.

To remove protection for the entire current table or all selected tables, press Shift+Ctrl+T.

Tip

If you cannot place the cursor in a protected cell, you need to enable the cursor. Choose Tools > Options > LibreOffice Writer > Formatting Aids and in the Protected Areas section mark Enable cursor.

Adding a caption

You can easily add a caption to any table. Writer will keep track of all your captioned tables, automatically number them, and update any links to them. To add a caption to a table:

1)  Right-click anywhere in the table and select Insert Caption in the context menu, or choose Insert > Caption on the Menu bar, or click the Insert Caption icon on the Table toolbar.

2)  Under Properties on the Caption dialog, make your selections for the Category (it defaults to Table, which is usually what you want), Numbering, and Separator fields. The position of the caption defaults to above a table; you can change this if necessary.

3)  Type your caption text in the text box at the top of the dialog.

4)  Click OK.

You can also set up Writer to add captions to tables automatically. The procedure is the same as for adding captions automatically to images, described in Chapter 11.

Cross‑referencing to a table

You can insert a cross‑reference to a captioned table. Clicking on the cross-reference takes the reader directly to the table. For details, see Chapter 17, Fields.

Splitting a table

One table can be split into two tables, and two tables can be merged into a single table. Tables are split horizontally: the rows above the split point are put into one table, and the rows below into another. To split a table:

1)  Place the cursor in a cell that will be in the top row of the second table after the split (the table splits immediately above the cursor).

2)  Choose Table > Split Table on the Menu bar or click the Split Table icon on the Table toolbar.

3)  A Split Table dialog opens, where you can choose how to handle heading rows.

4)  Click OK. The table is then split into two tables separated by a blank paragraph.

Note

If cells in one table include formulas using data from the other table, those cells will contain an error message: **Expression is faulty**.

Merging tables

To merge two tables:

1)  Delete the blank paragraph between the tables. You must use the Delete key (not the Backspace key) to do this.

2)  Select any cell in one of the tables.

3)  Choose Table > Merge Table from the Menu bar.

Tip

To see clearly where the paragraphs are and to delete them easily, choose View > Formatting Marks (Ctrl+F10) or click the ¶ icon in the Standard toolbar.

Deleting a table

To delete a table, do any of the following:

Note

The third method also merges the paragraph after the table with the paragraph before the table, which may not be what you want.

Copying a table

To copy a table from one part of the document and paste it into another part:

1)  Select the table.

2)  Press Ctrl+C or click the Copy icon on the Standard toolbar.

3)  Click where you want the table to be copied.

4)  Press Ctrl+V or click the Paste icon on the Standard toolbar.

Moving a table

To move a table from one part of a document to another part:

1)  Select the table.

2)  Press Ctrl+X or click the Cut icon on the Standard toolbar.

3)  Click where you want the table to be moved.

4)  Press Ctrl+V or click the Paste icon on the Standard toolbar. This pastes the cells and their contents and formatting.

Inserting a paragraph before or after a table

To insert a paragraph before a table, position the cursor before any text or other contents in the first (upper left-hand) cell and press Alt+Enter. To insert a paragraph after a table, position the cursor after any text in the last (lower right-hand) cell and press Alt+Enter.

Using tables as a page layout tool

Tables may be used as a page layout tool to position text in a document instead of using tabs or spaces. For more information and tips about using tables in page layout, see Chapter 6, Formatting Pages: Advanced.

Contents