Writer Guide 7.2

Chapter 13
Tables of Data

CopyrightThis document is Copyright © 2021 by the LibreOffice Documentation Team. Contributors arelisted below. You may distribute it and/or modify it 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

Kees Kriek

To previous editions
Jean Hollis Weber
Bruce Byfield
Shravani Bellapukonda

Kees Kriek
John A Smith
Ron Faile Jr.

Gillian Polack
Barbara Duprey

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 otherpersonal information that is written in the message, is publicly archived and cannot
be deleted.

Publication date and software version
Published August 2021. Based on LibreOffice 7.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 andLinux. The table below gives some common substitutions for the instructions in this document.
For a detailed list, see the application Help.
Windows or LinuxmacOS equivalent

EffectTools > 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

F11

⌘+T

Open the Styles deck in the
SidebarDocumentation for LibreOffice is available at https://documentation.libreoffice.org/en/Contents
Copyright............................................................................................................................2
Contributors.............................................................................................................................. 2
Feedback.................................................................................................................................. 2
Publication date and software version.......................................................................................2
Using LibreOffice on macOS.....................................................................................................2

Introduction........................................................................................................................5
Tools for working with tables...........................................................................................5
Creating a table..................................................................................................................7
Creating a new table................................................................................................................. 7
Creating nested tables..............................................................................................................8
Using AutoCorrect to create a table..........................................................................................9
Creating a table from formatted text..........................................................................................9
Example............................................................................................................................. 10
Inserting a portion of a spreadsheet........................................................................................10

Formatting the table layout............................................................................................11
Default parameters..................................................................................................................11
Resizing and positioning the table...........................................................................................11
Specifying text flow................................................................................................................. 12
Resizing rows and columns.....................................................................................................13
Inserting rows and columns.....................................................................................................15
Deleting rows and columns.....................................................................................................16
Merging and splitting cells.......................................................................................................16
Specifying table borders.......................................................................................................... 17
Selecting background colors and graphics..............................................................................18
Displaying or hiding table boundaries......................................................................................19

Creating and applying table styles................................................................................20
Applying a table style.............................................................................................................. 20
Creating a table style.............................................................................................................. 20

Formatting the table text................................................................................................21
Vertical alignment.................................................................................................................... 21
Number formats...................................................................................................................... 21
Rotating text in a table cell......................................................................................................22

Data entry and manipulation in tables..........................................................................23
Moving between cells.............................................................................................................. 23
Sorting data in a table............................................................................................................. 23
Using spreadsheet functions in a table....................................................................................24

Additional table operations............................................................................................26
Protecting cells in a table........................................................................................................ 26
Adding a caption..................................................................................................................... 26
Cross-referencing to a table....................................................................................................27
Splitting a table....................................................................................................................... 27
Chapter 13 Tables of Data | 3

Merging tables........................................................................................................................ 27
Deleting a table....................................................................................................................... 27
Copying a table....................................................................................................................... 28
Moving a table......................................................................................................................... 28
Inserting a paragraph before or after a table...........................................................................28
Using tables as a page layout tool..........................................................................................28

4| Chapter 13 Tables of DataIntroduction
Tables are a useful way to organize and present large amounts of information, for example:•

Technical, financial, or statistical reports.

•

Catalogs showing descriptions, prices, characteristics, and photographs of products.

•

Bills or invoices.

•

Lists of names with address, age, profession, and other information.

Tables can often be used as an alternative to spreadsheets to organize materials. A welldesigned 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 atable” on page 24.
Tables can also be used as a page-layout tool to position text in areas of a document instead ofusing 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 oftables 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: The Table menu

Tools for working with tables | 5

When you create a table or select an existing table, the Table toolbar (Figure 2) is displayed
automatically. You can manually display it at any time by clicking 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, andhow to hide and display specific tools on a toolbar.

Figure 2: The Table toolbar
1
2
3
4
5
6
7
8
9
10
11

Rows AboveRows Below
Columns Before
Columns After
Delete selected rows
Delete selected columns
Delete table
Select Cell
Select Table
Merge Cells
Split Cells

12
13
14
15
16
17
18
19
20
21
22

Split Table
Optimize Size
Align Top
Center Vertically
Align Bottom
Table Cell Background Color
AutoFormat Styles
Borders
Border Style
Border Color
Number Format: Currency

23
24
25
26
27
28
29
30
31
32

Number Format: Percent
Number Format: Decimal
Number Format
Insert Caption
Sort
Protect Cells
Unprotect Cells
Sum
Insert Text Formula
Table Properties

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

Figure 3: Table properties in Sidebar

6 | Chapter 13 Tables of Data

Creating a table
Before you create a table in a Writer document, it helps to have an idea of the visual result you
want and an estimate of the number of rows and columns required. Every parameter can bechanged 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 iconon 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.
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 the following methods to open the Insert Table dialog:•

Choose Table > Insert Table on the Menu bar.

•Press Ctrl+F12.

•

On the Standard toolbar, click the Insert Table icon and select More Options at thebottom of the drop-down graphic.

In the General section of the Insert Table dialog (Figure 4), in the Name box, you can enter adifferent name from the Writer-generated default for the table. This might come in handy whenusing 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.

Creating a table | 7

Figure 4: Insert Table dialog
Under Options, set up the initial table characteristics:•

Heading — Enables a heading to be used in the table and defines the number of rows to
be used as headings. A second (and, occasionally, third) heading row can be useful for
sub-headings in a complex table.
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.

•

Repeat heading rows on new pages — Enables the heading rows to be repeated at the
top of subsequent pages if the table spans more than one page.

•

Heading rows — Specifies the number of rows to be used for the heading. Default is 1.

•

Don’t split table over pages — Prevents the table from spanning more than one page.
This can be useful if the table starts near the end of a page, and would look better if itwere completely located on the following page. If the table starts earlier on the page but
does not all fit, this setting can lead to awkward page breaks. If the table becomes longer
than would fit on one page, either deselect this option or manually split the table.

The Styles section lists several predefined table layouts, also known as table styles. See“Creating and applying table styles” on page 20 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 theleft page margin to the right page margin), with all columns the same width and all rows the sameheight. You can adjust the columns and rows later to suit your needs.

8 | Chapter 13 Tables of Data

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 5 demonstrates a simple, two-level
example. The shaded table is inside a cell of the larger table. To achieve this, simply click in a cellof an existing table and use any of the methods mentioned in “Creating a new table” above.

Figure 5: 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 widthof a column. When using tabs, the default tab setting determines the width; this setting can bechanged in Tools > Options > LibreOffice Writer > General.
For example, this character sequence:+-----------------+---------------+------+
creates a table like this:

NoteThis 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
You can create a table from formatted text by using 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 you want to convert and choose Table > Convert > Text toTable to open the dialog shown in Figure 6.
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 typeany character in the box.
The Options are the same as those in the Insert Table dialog (Figure 4).
3) Click OK to convert the text.

Creating a table | 9

Figure 6: Dialog for text to table conversion

ExampleIn 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.
Row 1 Column 1
Row 2 Column 1

Row 1 Column 2
Row 2 Column 2

Row 1 Column 3
Row 2 Column 3

Tip
You can also perform the opposite operation, to transform a table into plain text. Thismay be useful when you want to export the table contents into a different program.
To transform a table into text, 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.

10 | Chapter 13 Tables of Data

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 andapplying table styles” on page 20.
Formatting the layout normally involves one or more of the following operations: adjusting thesize 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 andbackground.

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:•

The cells use the Table Contents paragraph style. In the default template, this style isidentical to the Default Paragraph Style.

•

The default table occupies all the space from margin to margin (text area).

•

The default table has thin black borders around each cell (grid).

•

If you activate the Heading option, the cells in the heading row (or rows) use the Table
Heading paragraph style.

Resizing and positioning the table
Using the default settings, any newly created table will occupy the entire width of the text area.
This is sometimes what you want, or you may prefer a smaller table. To quickly resize a table,
first move the mouse to either the left or right edge. When the cursor changes shape into adouble arrow, drag the border to the new position. This operation only changes the size of thefirst 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, open the Table
Properties dialog (Figure 7) by choosing Table > Properties or by right-clicking anywhere in thetable and choosing Table Properties in the context menu.

Figure 7: Table Properties dialog: Table tab
Formatting the table layout | 11

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

Automatic: the default setting for a table, fills the width of the text area.

•

Left: aligns the table with the left margin.

•

Right: aligns the table with the right margin.

•

From Left: lets you specify under Spacing exactly how far from the left margin the table
is placed.

•

Center: aligns the table in the middle between the left and right margins. If the table
width is greater than the margin, the table will extend outside of the margins.

•

Manual: lets you specify the distances from both left and right margins under Spacing.

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 aspercentage 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 inthe Left and Right boxes. Otherwise these values are not available. You can enter values:•

In both the Left and Right boxes if you select Manual alignment.

•

In the Left box when you select the From left, Right, or Center alignment.

•

In the Right box if you select Left alignment.

Specifying text flow
On the Text Flow tab of the Table Properties dialog (Figure 8), you can:•Insert a page or column break either before or after the table. Use the Text Flow: Breakoption, combined with the Page or Column and the Before or After options. If you insert
a page break before the table (that is, start the table on a new page), you can alsochange the page style that will go with it by selecting With Page Style and a new pagestyle. As with any page break, you can also reset the page numbers using the Page
number box.

•

Keep a table on one page by deselecting Allow table to split across pages andcolumns. If this item is deselected, the next item is not active.

•

Keep each row on one page by deselecting Allow row to break across pages andcolumns.

•

Use Keep with next paragraph to keep the table and an immediately following
paragraph together if you insert a page break.

•Use Repeat heading, and its associated numbers box, to select the number of tableheading rows that will be repeated on each page. A complicated table may need two or
three heading rows to be easily read and understood.

•

Use the Text orientation list to select the direction for the text in the cells. Select from
Horizontal, Vertical (top to bottom), Vertical (bottom to top), or Use superordinate object
settings (meaning use the default text flow settings for the page).

•

Select the vertical alignment of the text in the table or the selected cells; the choices areto align with the top of the cell, the center of the cell, or the bottom of the cell. Thisalignment is in addition to the Left-Right alignment options available on the Table tab of
the Table Properties dialog.

12 | Chapter 13 Tables of Data

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 aheading, will not break across pages. The solution is to make sure the table isdefined without a heading row.

Figure 8: 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.
•

Move the mouse next to the edge of the cell and when a double-headed arrow appears,
click and hold the left mouse button, drag the border to the desired position, and release
the mouse button.

•

On the horizontal ruler, column dividers are marked by a pair of thin gray lines; thevertical ruler indicates row dividers in the same way. You can resize a row or column byholding the mouse button down on the appropriate divider and dragging it to the desired
location.

•

Use the keyboard as described below.

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

Select Column Width or Row Height to enter a dimension into the size box for eachselectable column or row of the table.

•

The Minimize Column Width or Minimize Row Height options make the selected columns
or rows as narrow as possible while still fitting their contents. The rows or columns may
not all be the same height or width.

•

The Optimal Column Width or Optimal Row Height options make the selected columns orrows fit the largest character in any row or the longest entry in any column.

•

Use Distribute Columns/Rows Evenly to quickly bring them back to all being the same
width or height.

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

Formatting the table layout | 13

Figure 9: 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.
•

Adapt table width: If a table already stretches to the page margins, it cannot stretch any
wider and the Adapt table width option can only be used to reduce the column width. If
the table is narrower, increasing the width of a column will increase the width of thewhole table. This option is not available if Automatic has been selected in the Alignmentarea of the Table tab.

•If the table width already extends past the margins, with the Adapt table width option
checked, attempting to change a column width will automatically decrease that column’s
size so that the table will now shrink to the page margins while keeping the size of any
other column intact.

•

Adjust columns proportionally results in all columns changing their widths by the same
percentage when one is changed. For example, if you reduce by half the size of acolumn, the sizes of all the other columns will be halved. This option is not available if
Automatic has been selected in the Alignment area of the Table tab.

•Remaining space shows how much further the table can expand before hitting the limitof the margins. This value cannot be edited and will not be negative in the event that thetable width is already larger than the space between the left and right margins.

•

Under Column width, each individual column can be adjusted. If you have more than six
columns, use the arrows at the right and left to view them all. With no options selected,
the column to the right of the one being adjusted will automatically change to keep thetable width constant. Adjusting the most right hand column causes the first column tochange.

Tip
Rather than starting from the Table Properties dialog, it is often more efficient tomake rough adjustments to a new table using the mouse, and then fine-tune thelayout using the Columns tab and the Table tab of the Table Properties dialog.
You can also resize a table using the keyboard. This is sometimes easier than using the mouse.
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.
– The left and right arrow keys adjust the column width by moving the border on theright edge of the cell, but not past the margin.
– The up and down arrows adjust the row height (when possible) by moving the borderon the lower edge of the cell.

14 | Chapter 13 Tables of DataTo adjust the resizing parameters and behavior for keyboard handling, choose Tools > Options> LibreOffice Writer > Table (Figure 10).

Figure 10: 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 canchoose one of three strategies when resizing:•

Fixed: the resizing will affect only the adjacent cell and not the entire table. The width of
the table does not change when resizing its cells.

•

Fixed, proportional: when resizing a cell, all the other cells are also resized
proportionally, but in the opposite direction so as to maintain the width of the table.

•

Variable: resizing a cell affects the table size. For example, when you widen a cell, thewidth of the table increases. This is the default option.

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:•

Click the Rows Above or Rows Below icons on the Table toolbar or the Table panel ofthe Properties deck on the Sidebar to insert one row above or below the selected one.

•

Click the Columns Before or Columns After icons on the Table toolbar or the Table
panel of the Properties deck on the Sidebar to insert one column before or after theselected one.

•

Choose Table > Insert > Rows Above/Below or Table > Insert > Columns
Before/After on the Menu bar.

•

Right-click and choose Insert > Rows Above/Below or Insert > Columns Before/Afterin the context menu.

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 rightclick 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 orcolumns to insert, and Position to Before or After.
4) Click OK to close the dialog.

Formatting the table layout | 15

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 deleteand do one of the following:•

Click the Delete selected rows or Delete selected columns icons on the Table toolbar
or the Table panel of the Properties deck on the Sidebar.

•

Right-click and choose Delete > Rows or Delete > Columns.

•

Choose Table > Delete > Rows or Table > Delete > Columns on the Menu bar.

Merging and splitting cells
A common use for merging cells is to make a heading row that takes up the entire width of thetable, 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 panelof 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 theProperties 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 11: Split Cells dialog
It is generally best to merge and split cells after completing other layout formatting. This isbecause some operations such as deleting a column or a row may produce a result difficult topredict when applied to a table with merged or split cells.

16 | Chapter 13 Tables of Data

Specifying table borders
You can quickly apply some table borders using 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 12).

Figure 12: Table Properties dialog: Borders page•Line arrangement specifies where the borders go. If a group of cells is selected, theborder will be applied only to those cells. You can specify individually the style of theborder for the outside edges of the selected cells and for the cell divisions. Writer
provides default arrangements, but you can click the line you want to customize in theUser-defined area to get exactly what you want. When multiple cells are selected, you
can select the edges of the selection as well as the cell dividers.

Note
When the selected cells have different styles of border, the User-defined area shows
the border as a gray line. You can 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).
•Line specifies what the border looks like. You can choose from the drop-down lists for
Style and Color, and specify a Width. Your selections apply to those borders highlighted
by a pair of black arrows in the User-defined area.

•

Padding specifies how much space to leave between the border and the cell contents.
Spacing can be specified individually for thr left, right, top, and bottom borders. Choose
Synchronize to have the same spacing on all four sides.

•

Shadow Style properties always apply to the whole table. A shadow has threecomponents: where it is (position), how far from the table it is cast (distance), and what
color it is.

Formatting the table layout | 17

•If Merge adjacent line styles (under Properties) is checked, two cells sharing a common
border will have their borders merged, rather than being side by side or above/below
each other.

Tip
To reset everything if you are having problems with borders, right-click in the table
and choose Table Properties or choose Table > Properties on the Menu bar. On
the Borders tab, select the Set No Borders icon under Line arrangement Presets(the box on the left).

Selecting background colors and graphics
A table background can greatly improve the readability of data, visually highlight important partsof 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 beapplied 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 theTable Properties dialog (Figure 13).

Figure 13: Table Properties dialog: inserting an image as a backgroundTip
You need to consider the color contrast between the background and foreground(usually text). Background colors and images can also have transparency applied tohelp make the text more readable.
The row background option is quite handy when you want to create alternate colorrows or assign a different background to the heading of the table.

18 | Chapter 13 Tables of Data

Note
The background selected for a cell will be in front of the row background which inturn 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 you want to work with. If you want
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 theProperties deck on the Sidebar.
3) In the Table Properties dialog, select the Background tab (Figure 13).
4) Choose whether to apply the settings to cell, row, or table.
– Cell: changes apply only to the selected cells, or the cell where the cursor currently
resides. Even when a group of cells is selected, the background settings are applied
to each cell individually.
– Row: changes affect the entire row where the cursor resides.
– Table: changes will set the background for the entire table, regardless of the cursor
position or selected cells.
5) To apply a color, click the Color button, select the color, and click OK.
To apply a bitmap (image), click the Bitmap button. Then,a) Select from the given bitmaps or use the Add/Import button.
b) Under Options, select the type of placement for the image.
– Style – select the way the image has to appear: custom position/size, tiled, or
stretched.
– Size – select the required Image aspect ratio or the Scale option.
– Position – select where 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 tohelp you see where the table cells are. They are particularly useful when using tables for pagelayout.
To display tables the same way on the screen as on the printed page, with no boundary lines, go
to Tools > Options > LibreOffice > Application Colors. On that page, you can display or hideboundaries around text, tables, headers and footers, figures, and other parts of a document, andyou can choose the color of boundary lines.
Turning boundaries off does not hide any borders that the table may have.

Formatting the table layout | 19

Creating and applying table styles
Using table styles, you can apply an elaborate format to your table with just a few clicks. Likeother 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 14), select a format from thelist, 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 14: Table 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 tablestyles, 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 Menubar, or click the AutoFormat Styles icon on the Table toolbar.
3) On the AutoFormat dialog (Figure 14), choose which features you wish 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.
20 | Chapter 13 Tables of Data

Table styles also include the following table-level properties:
•

Break

•

Keep with next paragraph•

Repeat heading•

Allow table to split across pages•

Allow rows to break across pages•

Merge adjacent line styles•

Table shadow

Tip
These styles do not include table and column widths in the table format. To insert atable with predefined full formatting, save it as AutoText. See “Using AutoText” in
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 ofmaintenance. 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 groupof 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 thedefault 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 dateformat.
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 areautomatically left-aligned. To enable Number recognition, go to Tools > Options > LibreOffice
Writer > Table and select the option in the Input in Tables section.

Formatting the table text | 21

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

In the Category list, select the category you want, such as currency, date, or text.

•

In the Format list, choose a format for the category you just selected.

•

For some categories, such as Date, you may wish to change the language using theLanguage list, while for other numerical categories you can use the Options section of
the dialog to customize the appearance.

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 caneasily customize this formatting code as well as create new user-defined codes.

Figure 15: The 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.
•

Select the text to be rotated and then choose Format > Character, or right-click andselect Character > Character in the context menu.

•

On the Position tab, in the Rotation / Scaling section, choose the rotation angle,
optionally change the Scale width, and click OK.

Figure 16 shows a sample table with rotated headings.

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

22 | Chapter 13 Tables of Data

Figure 16: A table with rotated headings

Data entry and manipulation in tables
Moving between cells
Within a table, you can use the mouse, the arrow keys, or the Tab key to move between cells.
The arrow keys move the cursor one text character left or right at a time. If a cell is empty,
pressing the arrow key will move 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, createsa 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 tothe beginning of the table. If the cell has content, the first press goes to the beginning of the celland the next press goes to the beginning of the table. (Pressing again takes you to the beginningof the document.)
To move to the end of the table, press Ctrl+End. If the active cell is empty, the move is to the endof 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 takes you 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 ofsorting (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.

Data entry and manipulation in tables | 23

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.

Note
You have 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.

Figure 17: Selecting criteria for sorting

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 therow). 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 (firstcolumn, 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 thesum 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, orpress 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.

24 | Chapter 13 Tables of Data

The Formula bar appears automatically at the top of the workspace. In the leftmost sideof 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 Formulabar 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 theselected cell and on the Object bar.
5) Press the Enter key, or click the green check mark (may be a different symbol on someinstallations) on the Formula Bar, to replace the formula in the cell with the result of thecalculation.

Figure 18: Using spreadsheet functions in a table

Tip
To display a cell's formula and make it available for editing, choose Table > Formulaon 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 cansimply select the cells in the row, column, or the rectangle of rows and columns. Thus, forexample, 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 cell you have selected.
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 cell you have selected.

Data entry and manipulation in tables | 25

Caution
Unlike in Calc, formulas are not updated automatically when inserting or deletingrows or columns of the table, although the results do update when you change avalue in a cell. If you plan 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.

NoteThis 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 theProtected 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, orchoose 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 positionof 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.

26 | Chapter 13 Tables of Data

Cross-referencing to a table
You can insert a cross-reference to a captioned table. Clicking on the cross-reference takes thereader 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 (thetable 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 willcontain 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:•

Right-click anywhere in the table and choose Delete > Table in the context menu.

•

Click anywhere in the table and choose Table > Delete > Table on the Menu bar.

•

Select from the end of the paragraph before the table to the start of the paragraph after
the table, and then press the Delete key or the Backspace key.

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

Additional table operations | 27

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 andtheir 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 thefirst (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 orspaces. For more information and tips about using tables in page layout, see Chapter 6,
Formatting Pages: Advanced.

Tip
When inserting a table used for layout, you may wish to deselect the Heading and
Border options (see “Creating a new table” on page 7).

28 | Chapter 13 Tables of Data