12 April 2014: The OpenOffice Wiki is not, and never was, affected by the heartbleed bug. Users' passwords are safe and wiki users do not need take any actions.

Formatting a table

From Apache OpenOffice Wiki
Jump to: navigation, search


Default parameters

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

  • The cells in the first row use the Table Heading paragraph style. In the default template, the text is centered and set with a bold and italic font.
  • The remaining cells use the Table Contents paragraph style, which, in the default template, is identical to the Default paragraph style.

Formatting individual cells

You can format each cell independently of other cells. For example, you can:

  • Format the characters — change the font, the font style, and the background colors.
  • Set different indentation values — when you select a cell, the horizontal ruler shows the indentation points with gray pentagons. Vary the indentation by clicking and dragging these points.
  • Change the text alignment — for example, a number can be aligned to the right, while text on another line in the cell is aligned to the left or centered.

To change the format of a cell or range of cells:

  1. Select the cell or range of cells to be modified. You can select a single cell by clicking in it, select a range with click and drag, or select a row or column using menu or toolbar choices.
  2. Right-click the selection and select Table, or select Table > Table Properties from the menu bar.
  3. From the Table Format dialog box, select the property to modify.

The figure below shows some examples.

Cell alignment
Formating the contents of individual cells: The 0 is right-aligned; the 4 is centered and the indentation in that cell has been increased; the 5 is left-aligned.

Inserting rows and columns

To insert any number of rows or columns:

  1. Place the cursor in the row or column where you want new rows or columns to be inserted and right-click. On the pop-up menu, select Row > Insert or Column > Insert. This will display a dialog box where you can select the number of rows or columns to add before or after the selected one.
  2. Set Amount to the number of rows or columns to insert and Position to Before or After. Click OK to close the dialog box.
Documentation note.png Clicking on the Insert Row icon on the Table toolbar inserts one row below the selected one. Clicking on the Insert Column icon on the Table toolbar inserts a column after (to the right of) the selected one.

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

Merging and splitting cells

To merge a group of cells into one cell:

  1. Select the cells to merge.
  2. Right-click and select Cell > Merge on the pop-up menu, or select Table > Merge Cells from the menu bar.

To split a cell into multiple cells:

  1. Position the cursor inside the cell.
  2. Right-click and select Cell > Split on the pop-up menu, or select Table > Split Cells from the menu bar.
  3. Select how to split the cell. A cell can be split either horizontally (create more rows) or vertically (create more columns), and you can specify the number of new cells to create.

Merging and splitting tables

A whole table can be split into two tables, and two tables can be merged into a single table. Tables are split only 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 which will be in the top row of the second table after the split (the table splits immediately above the cursor).
  2. Right-click and select Split Table in the pop-up menu. You can also use Table > Split Table from the menu bar.
  3. A Split Table dialog box will pop up regarding the heading. You can select No heading or an alternative formatting for the heading—the top row(s) of the new table.

The table is then split into two tables separated by a blank paragraph.

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 a cell in the second table.
  3. Right-click and select Merge Tables in the pop-up menu. You can also use Table > Merge Table from the menu bar.
Tip.png To see clearly where the paragraphs are and to delete them easily, select View > Nonprinting Characters (Ctrl+F10) or click the button in the Standard toolbar.


Choosing table spacing and alignment

You can specify how the table is aligned on the page and what space to leave around the table.

Right-click anywhere in the table and select Table from the pop-up menu or select Table > Table Properties from the menu bar. On the Table Format dialog box, select the Table tab.

Table Format dialog box
Table Format dialog box: Table page

On this page, you can:

  • Set a name for the table. This has no effect on the display but makes the table easier to find when using the Navigator. This can be very useful if your document has a number of tables. A table name cannot have any spaces. To make a meaningful name, you could use underscores or hyphens (for example, Table-1_Doll_House_Inventory).
  • Set the overall width of the table, either absolute or relative to the page width. This option is available only if the Alignment is not set to Automatic. (See below.)
  • Specify how the table is aligned if it does not fill the width of the page (between the margins). Under Alignment:
    • 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 less than the space between the margins, the excess is evenly distributed on both sides of the table. If the table width is greater, the table will extend outside of the margins.
    • Manual lets you specify the distances from both left and right margins under Spacing.
  • Under Spacing: Above and Below, specify the distances to leave above and below the table.

Specifying text flow

Table Format dialog box
Table Format dialog box: Text Flow page

On the Text Flow page of the Table Format dialog box, you can:

  • Insert a page or column break either before or after the table. Use the Text Flow: Break check box, combined with the Page or Column and the Before or After buttons.
    If you insert a page break before the table (that is, start the table on a new page), you can also change the page style that will go with it by checking the With Page Style box and selecting a new page style. 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 the Allow table to split across pages and columns check box. If this item is deselected, the next item is not active.
  • Keep each row on one page by deselecting the Allow row to break across pages and columns check box.
  • Use the Repeat heading check box and the numbers box to select the number of table heading 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 direction list to select the direction for the text in the cells. The most common setting is Left to right for Western languages. Note: The phrase Use superordinate object settings means "use the formatting settings from the paragraph before the table.”
  • Select the vertical alignment of the text in the table or the selected cells; the choices are to align with the top of the cell, the center of the cell, or the bottom of the cell. This alignment is in addition to the Left-Right alignment options available under Table > Table Properties > Table or by right-clicking and choosing Table > Table.
Documentation note.png A Table Heading row may not span two pages, but any other row may. 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 cure is to make sure the table is defined without a heading row.

Resizing rows and columns

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

You can manually resize rows and columns by dragging them to the desired size. When the cursor is in the table, a pair of thin gray lines (||) appear in the rulers.

The horizontal ruler shows the column dividers, and the vertical ruler shows the row dividers.

To change the width of a column or height of a row, use one of these methods:

  • Hold the mouse button down on a cell border, so a double-headed arrow appears, and and drag the border to the desired position.
  • To change the column width using the ruler, hold the mouse button down on the appropriate column divider (double vertical line) so that a double-headed arrow appears and drag the divider to a new location.
  • To change the row height using the ruler, hold the mouse button down on the appropriate row divider (double horizontal line) so that a double-headed arrow appears and drag the divider to a new location.

Selecting Table > Autofit from the main menu offers some shortcuts to resizing:

  • Optimal column width or row height will make the columns or rows as narrow as possible while still fitting their contents.
  • Columns and rows can be distributed 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 page of the Table format dialog box.

Table Format dialog box
Table Format dialog box: Columns page

Right-click on the table and select Table from the pop-up menu or select Table > Table Properties from the menu bar. On the Table Format dialog box, 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 is not available. If the table is narrower, increasing the width of a column will increase the width of the whole table.
    If the table width already extends pasts 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 any other column sizes intact.
  • Adjust columns proportionally results in all columns changing their widths by the same amount when one is changed.
  • Remaining space shows how much farther the table can expand before hitting the limit of the margins. This value cannot be edited and will not be negative in the event that the table 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.

Specifying table borders

On the Table Format dialog box, select the Borders tab.

Table Format dialog box
Table Format dialog box: Borders page

Here you can set borders for a whole table or groups of cells within a table. In addition, a shadow can be set for the whole table.

Borders have three components: where they go, what they look like, and how big a space is left around them.

  • Line arrangement specifies where the borders go. If a group of cells is selected, the border will be applied only to those cells. You can specify no border or any combination of border for the outside edges and the cell divisions—either by selecting a default arrangement or by clicking on the lines in the User-defined area to get exactly what you want.
  • Line specifies what the border looks like: the style and color. There are a number of different styles and colors to choose from.
  • Spacing to contents specifies how much space to leave between the border and the cell contents. Spaces can be specified to the left, right, above, and below. Check Synchronize to have the same spacing all the way round.

Shadows always apply to the whole table. A shadow has three components: where it is, how thick it is, and what color it is. Set each of these under Shadow style on the dialog box.

If Merge adjacent line styles is checked, two cells sharing a common border will have their borders merged, rather than being side by side.

Tip.png To reset everything if you are having problems with borders, right-click in the table and select Table > Borders or select Table > Table Properties > Borders and then select the Set no borders icon under Line arrangement: Default (the box on the left).


Selecting background colors and graphics

The background of a table, a cell, or a group of cells can be set to a color or a background graphic. If you select an image, you can position it in the cell (or group of cells), stretch it to fill the space, or tile the image across the cells. You can set the background for the whole table in the same way.

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

  1. Select the cells you wish to work with. If you are changing the background for a row or table, just place the cursor anywhere inside the row or table to be changed.
  2. Right-click and select Table from the pop-up menu, or select Table > Table Properties from the main menu.
  3. In the Table Format dialog box, select the Background tab.
  4. In the For section, chose whether to apply the settings to cell, row, or table. If you choose Cell, any changes apply to all the selected cells.
  5. In the As section, choose whether the background is a color or a graphic.
  6. To apply a color, select the color and click OK.
  7. To apply a graphic, first select the graphic to use. This must be a graphic file accessible from your computer. (Writer supports a large number of graphics formats.)
    • You have the option with the Link check box to link the graphic file. If it is linked, changes to the graphic (for example, if you edit it in a different package) will be reflected in your document. However, you also need to keep the linked graphic file with the document file. If, for example, you email the document without the graphic file, the graphic will no longer be visible.
    • Under Type, select the type of placement for the graphic. If you choose Position, you can select where to position the graphic within the cells, row, or table. If you choose Area, the graphic is stretched to fill the whole area. If Tile, the graphic is tiled (repeated horizontally and vertically) to fill the area.
    • If the Preview check box is checked, the graphic displays in the pane above the check box.
    • To apply the graphic, click OK.

See the figure below for an example of a background for a cell using an unlinked graphic which can be viewed in the Preview pane.

Table Format dialog box
Table Format dialog box: Background page

Vertical alignment

The default for text entered into table cells is for it to be aligned horizontally to the left, and numbers are aligned to the right. In addition, if more than one row of text is entered or if a graphic is used, text aligns vertically to the top of the cell and numbers to the bottom.

To vertically center align all of the text and numbers in the table:

  1. Move the cursor to the upper left-hand cell under the table heading and click and drag to the lower left hand cell.
  2. Documentation note.png By selecting all cells, the images will also be aligned.
  3. Right-click in the selected area and select Cell > Center in the pop-up menu.

Number formats

The number format can be set for a whole table or group of cells. 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. Number recognition can be set on or off under Tools > Options > OpenOffice.org Writer > Table.

Select the cells to format, then right-click and select Number Format from the pop-up menu. The Number Format dialog box opens for you to set options for various categories of numerical data.

  • In the Category drop-down list, select the category you want, such as currency, date, or text.
  • In the Format drop-down list, choose a format for the category you just selected.
  • For some categories, such as date, you may wish to change the language using the Language list.
  • Additional options are available for different categories.

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. Place the cursor in the table.
  2. Right-click and select Caption from the pop-up menu.
  3. Enter the text for your caption, the numbering style, and separator.
  4. Click OK.

To automatically caption all your tables:

  1. Place the cursor in a table.
  2. Right-click and select Caption from the pop-up menu.
  3. Select AutoCaption.
  4. Select OpenOffice.org Writer Table and select the settings you want and click OK. This dialog box is covered in more detail in Chapter 2 (Setting up Writer).

When AutoCaption is enabled for tables, all tables will be captioned; you will need to add the text for each caption onto the table manually.

Writer supplies five different category labels:

  • <None>
  • Drawing
  • Table
  • Illustration
  • Text

You can create your own category labels, formating, and separators—either under Insert > Caption or under Tools > Options > OpenOffice.org Writer > AutoCaption > OpenOffice Writer Table.

In either case, simply highlight a label and type in the new name. In the example below, we used Fantasia.

You can also change the separator or the format of the category label. For example, you might want your tables to be labeled as Fantasia and formated in bold type and using a period (‘.’) as a separator, as follows:

Fantasia 1. Interesting data

Fantasia 2. More interesting data

Fantasia 3. Yet more interesting data

To do this, you can highlight and replace a separator and then select Insert > Caption > Options > Character Style and assign a style, or you can set this up in the AutoCaption dialog box.

The format and separator if used under Insert > Caption only works for that specific table. However, it will work for that and all following tables if it is set up under AutoCaption.

When using AutoCaption, you need to remove the ‘.’ under Numbering captions by chapter > Separator if you are not using Chapter numbering to avoid having an extra punctuation mark added to the category label.

Cross-referencing a table

You can insert a cross-reference to a captioned table. Clicking on the cross-reference takes the reader directly to the table.

  1. Position the cursor where you want the cross reference.
  2. Select Insert > Cross-reference from the main menu.
  3. Set the Type to Table. A list of captioned tables will be shown in the Selection panel; select the one you want to reference.
  4. In the Format pane, choose how the cross reference will appear. For example, Category and Number will show up as Table 1 for the first table, while Numbering produces only 1, and Above/Below inserts one of those words as the reference.
  5. Click Insert to add the cross-reference and click Close to exit the dialog box.

AutoFormatting tables

You can use AutoFormat to make your table formats consistent. You can also create and add your own table autoformats. Here is how:

  1. Create a table and manually format it as you wish, including borders, spacing of text from the top and bottom borders, fonts to be used in the table heading and data cells, and background colors.
  2. Documentation note.png To use background colors in a new format, color the cells rather than the table. That is, select the cell or cells you wish to color, select Table > Table Properties > Background (or right-click Table > Background), choose a color, and specify As: Color, For: Cell.
  3. Position the cursor anywhere in the table and then click Table > AutoFormat.
  4. On the AutoFormat dialog box, click Add and give the table format a name in the AddAutoFormat dialog box and click OK.
  5. The newly named autoformat now appears as an available format. Click OK to close the AutoFormat dialog box.
Tip.png This technique does not include table and column widths in the table format. To insert a table with predefined full formatting, save it as AutoText.


AutoFormat dialog box
AutoFormat dialog box

Create a heading row in an existing table

To create a heading row in an existing table that does not have one, you need to apply an autoformat that does have a heading defined. (Here is where having some personalized table formats could come in very handy.) Place the cursor anywhere in the table and then click Table > AutoFormat. Choose a format. Click OK.

Rotating text in a table cell

You can rotate text in a table cell by 90 or 270 degrees. Text rotation is useful when you have long headings for narrow columns. Select the text to be rotated and then click Format > Character. On the Position page, in the Rotation / scaling section, choose the rotation angle and 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 OOo. These boundaries do not print and do not appear in PDFs; their only function is to help you see where the table cells are.

To display the table the same way on the screen as on the printed page, with no boundary lines, right-click on the table and select Table Boundaries from the pop-up menu. Repeat this to have the boundaries appear again.

Documentation note.png Turning boundaries off does not hide the borders that the table may have.
Tip.png You can also turn table boundaries on and off through Tools > Options > OpenOffice.org > Appearance. On that page, you can display or hide boundaries around text, pages headers and footers, figures, and other parts of a document.



Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools