Difference between revisions of "Documentation/OOoAuthors User Manual/Writer Guide/Working with Tables"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 13: Line 13:
 
Tables are a useful way to organize and present large amounts of information, for example:
 
Tables are a useful way to organize and present large amounts of information, for example:
  
** Technical, financial, or statistical reports
+
* Technical, financial, or statistical reports
** Product catalogs showing descriptions, prices, characteristics, and photographs of products
+
* Product catalogs showing descriptions, prices, characteristics, and photographs of products
** Bills or invoices
+
* Bills or invoices
** Lists of names with address, age, profession, and other information
+
* Lists of names with address, age, profession, and other information
Tables often can 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.
+
  
:Tables can also be used as a page layout tool to position text in areas of a document instead of using several ''Tab'' characters. For example, a business may prepare a template of a letter with its logo, the sender, receiver, date, and subject fields correctly positioned in a table with invisible borders. This use of tables is described in Chapter 4, “Formatting Pages".
+
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.
 
+
Tables are highly customizable in OpenOffice.org 2.0; some features that were lacking in version 1, such as nested tables, are now included.
+
  
 +
Tables can also be used as a page-layout tool to position text in areas of a document instead of using several ''Tab'' characters. For example, the descriptions under Figure 1 were created in a table with invisible borders. Another, perhaps better example would be in headers and footers to support independent positioning of different elements, such as page number, document title etc. This use of tables is described in Chapter 4 (Formatting Pages).
  
 
= The Table menu and toolbar =
 
= The Table menu and toolbar =
:Table commands are located in the main '''Table'''''' '''menu and on the Table toolbar, shown in Figure 1. Table 1 describes the functions of these commands and icons.
+
Table commands are located in the main '''Table '''menu and on the Table toolbar, shown in Figure 1. Table 1 describes the functions of these commands and icons. When you create a table or select an existing table, the Table toolbar may be displayed automatically, or you can manually display the Table toolbar by clicking '''View > Toolbars > Table'''. The toolbar can float on top of the main Writer window (as illustrated in Figure 1), or it can be docked along any edge of the main window.
  
: inline:Frame2.png
+
<center>[[Image:|thumb|<center></center> {| class="prettytable" | <center>'''''1''' Table''</center> | <center>'''''7''' Split Cells''</center> | <center>'''''13''' Insert Column''</center> | <center>'''''19''' AutoFormat''</center> |- | <center>'''''2''' Line Style''</center> | <center>'''''8''' Optimize''</center> | <center>'''''14''' Delete Row''</center> | <center>'''''20''' Table Properties''</center> |- | <center>'''''3''' Line Color (border)''</center> | <center>'''''9''' Top''</center> | <center>'''''15''' Delete Column''</center> | <center>'''''21''' Sort''</center> |- | <center>'''''4 '''Borders''</center> | <center>'''''10''' Center (vertical)''</center> | <center>'''''16''' Select Table''</center> | <center>'''''22''' Sum''</center> |- | <center>'''''5''' Background Color''</center> | <center>'''''11''' Bottom''</center> | <center>'''''17''' Select Column''</center> | |- | <center>'''''6''' Merge Cells''</center> | <center>'''''12''' Insert Row''</center> | <center>'''''18''' Select Row''</center> | |} <center>''Figure 1: Table toolbar''</center>]]</center>
  
:When you create a table or select an existing table, the Table toolbar may be displayed automatically. You can manually display the Table toolbar by clicking '''View > Toolbars > Table'''. It can float on top of the main Writer window (as above) or it can be docked along any side of the window.
+
''Table 1: Functions of the icons on the Table toolbar''
  
:''Table ''''1'''': Functions of the icons on the Table toolbar''
 
  
{|
+
{| class="prettytable"
| ||'''''Icon Name'''''||'''''Description'''''||
+
! Icon Name
 +
! Description
 +
 
 
|-
 
|-
| ||Table||Opens the Insert Table dialog box where you can set up and insert a table into the document. You can also use the mouse to click the arrow at the right, drag to select the number of rows and columns to include in the table, and then click in the last cell.||
+
| Table
 +
| Opens the Insert Table dialog box where you can set up and insert a table into the document, name the table for use with the Navigator, and set some options. You can also use the mouse to click the arrow at the right, drag to select the number of rows and columns to include in the table, and then release the mouse button on the last (lower right) cell.
 +
 
 
|-
 
|-
| ||Line Style||Opens the Border Style toolbar where you can modify the style of the border line.||
+
| Line Style
 +
| Opens the Border Style toolbar where you can modify the border line style.
 +
 
 
|-
 
|-
| ||Line Color||Opens the Border Color toolbar where you can modify the color of the border.||
+
| Line Color (border)
 +
| Opens the Border Color toolbar where you can modify the border color.
 +
 
 
|-
 
|-
| ||Borders||Opens the Border toolbar where you can select which sides should have a border.||
+
| Borders
 +
| Opens the Borders toolbar where you can select sides to have a border.
 +
 
 
|-
 
|-
| ||Background Color||Opens the Background toolbar where you can select the background color.||
+
| Background Color
 +
| Opens the Background toolbar where you can select the background color.
 +
 
 
|-
 
|-
| ||Merge Cells||Combines the selected cells to a single cell. Refer to “Merging and splitting cells" on page 6 for an example of using this button.||
+
| Merge Cells
 +
| Combines the selected cells into a single cell. Refer to “[[#Merging and splitting cells|Merging and splitting cells]]” on page [[#Merging and splitting cells|7]] for an example of using this button.
 +
 
 
|-
 
|-
| ||Split Cells||Opens the Split Cell dialog box where you can define how to split a cell. Refer to “Merging and splitting tables" on page 6 for an example of using this button.||
+
| Split Cells
 +
| Opens the Split Cell dialog box where you can define how to split a cell. Refer to “[[#Merging and splitting tables|Merging and splitting tables]]” on page [[#Merging and splitting tables|7]] for an example of using this button.
 +
 
 
|-
 
|-
| ||Optimize||Open the Optimize toolbar where you can distribute the columns or rows evenly or optimize the row height or column width.||
+
| Optimize
 +
| Opens the Optimize toolbar where you can distribute the columns or rows evenly or optimize the row height or column width.
 +
 
 
|-
 
|-
| ||Top||Aligns the contents of the selected cells to the top of the cell.||
+
| Top
 +
| Aligns the contents of the selected cells to the top of the cell.
 +
 
 
|-
 
|-
| ||Center (vertical)||Aligns the contents of the selected cells to the center of the cell.||
+
| Center (vertical)
 +
| Aligns the contents of the selected cells to the vertical center of the cell.
 +
 
 
|-
 
|-
| ||Bottom||Aligns the contents of the selected cells to the bottom of the cell.||
+
| Bottom
 +
| Aligns the contents of the selected cells to the bottom of the cell.
 +
 
 
|-
 
|-
| ||Insert Row||Inserts a row below the selected row.||
+
| Insert Row
 +
| Inserts a row below the selected row.
 +
 
 
|-
 
|-
| ||Insert Column||Inserts a column after the selected column.||
+
| Insert Column
 +
| Inserts a column after the selected column.
 +
 
 
|-
 
|-
| ||Delete Row||Deletes the selected row(s) from the table.||
+
| Delete Row
 +
| Deletes the selected row(s) from the table.
 +
 
 
|-
 
|-
| ||Delete Column||Deletes the selected column(s) from the table.||
+
| Delete Column
 +
| Deletes the selected column(s) from the table.
 +
 
 
|-
 
|-
| ||AutoFormat||Opens the AutoFormat dialog box where you can select among several predefined formatting sets including fonts, shading, and borders.||
+
| Select Table
 +
| Selects the entire table.
 +
 
 
|-
 
|-
| ||Table Properties||Opens the Table Format dialog box where you can modify various properties for the table, for example, name, alignment, spacing, column width, borders, and background.||
+
| Select Column
 +
| Selects the column in which the cursor is positioned.
 +
 
 
|-
 
|-
| ||Sort||Opens the Sort dialog box where you can specify the sort criteria for the selected cells.||
+
| Select Row
 +
| Selects the row in which the cursor is positioned.
 +
 
 
|-
 
|-
| ||Sum||Activates the sum function. Refer to “Using spreadsheet functions in a table" on page 18 for an example of using this button.||
+
| AutoFormat
 +
| Opens the AutoFormat dialog box where you can select among several predefined formatting sets. Each set is characterized by its own fonts, shading, and borders styles. You can also select '''AutoFormat''' from the Insert Table dialog box.
 +
 
 
|-
 
|-
|}
+
| Table Properties
 +
| Opens the Table Format dialog box where you can modify various properties for the table—for example: name, alignment, spacing, column width, borders, and background.
  
 +
|-
 +
| Sort
 +
| Opens the Sort dialog box where you can specify the sort criteria for the selected cells.
  
= Creating a table =
+
|-
:Before you insert a table into a document, it is a good plan to have an estimate of the number of rows and columns required. However, if necessary, you can easily make changes later.
+
| Sum
 +
| Activates the sum function. Refer to “[[#Using spreadsheet functions in a table|Using spreadsheet functions in a table]]” on page [[#Using spreadsheet functions in a table|21]] for an example of using this function.
  
 +
|}
 +
= Creating a table =
 +
Before you insert a table into a document, it is beneficial to have an estimate of the number of rows and columns required. However, if necessary, you can easily make changes later.
  
 
== Inserting a new table ==
 
== Inserting a new table ==
:To insert a new table, position the cursor where you want the table to go, then use any of the following methods to open the Insert Table dialog box (shown in Figure 2):
+
To insert a new table, position the cursor where you want the table to appear, then use any of the following methods to open the Insert Table dialog box (shown in Figure 2):
  
** From the main menu, select '''Table > Insert > Table'''.
+
* From the main menu, select '''Table > Insert > Table'''.
** Press ''Control+F12''.
+
* Press ''Control+F12''.
** From the Standard toolbar, click the '''Table''' icon inline:graphics2.png .
+
* From the Standard toolbar, click the '''Table''' icon [[Image:]].
: inline:Frame1.png
+
  
:Here you can specify the properties for the new table.
+
<center>[[Image:|thumb|<center>''Figure 2: Inserting a new table using the Insert Table dialog box''</center>]]</center>
  
:Under ''Size'', specify the initial number of columns and rows for the new table. You can change the size of the table later, if necessary.
+
Here you can specify the properties for the new table.
  
:Under ''Options'', set up the initial table characteristics. When the checkboxes are selected, the following actions occur.
+
Under ''Name'', you can enter a different name than the OOo-generated default for the table. This might come in handy in case you want the tables displayed in the Navigator in a certain (sorted) way.
  
** '''Heading''' - Defines the first row(s) in the table as headings. The default Table Heading paragraph style is applied to the heading rows and thus makes the text centered, bold, and italic. You can edit the Table Heading in the Styles and Formatting window to change these default settings.
+
Under ''Size'', specify the initial number of columns and rows for the new table. You can change the size of the table later, if necessary.
** '''Repeat heading''' - Repeats the heading row(s) of the table at the top of subsequent pages if the table spans more than one page.
+
:''The first ... rows'' - Specifies the number of rows to be repeated. Default is 1.
+
  
** '''Don't split table''' - Prevents the table from spanning more than one page. This can be useful if the table starts near the end of a page and it would look better if the whole table were located on the following page. If the table ends up longer than what fits on one page, you need to either deselect this checkbox or manually split the table.
+
Under ''Options'', set up the initial table characteristics. Selecting the check boxes in this section of the dialog produces the following results:
** '''Border''''' ''- Surrounds each cell of the table with a border. This border can be modified or deleted later.
+
** '''AutoFormat''' - Selects one of the many predefined table layouts. See “AutoFormatting tables" on page 14 for more information.
+
:After making your choices, click '''OK'''. Writer creates a table as wide as the page margins, with all columns the same width and all rows the same height. You can then adjust the columns and rows to suit your needs.
+
  
{|
+
* '''Heading''' — Defines the first row(s) in the table as headings. The default ''Table Heading'' paragraph style is applied to the heading rows and thus makes the text centered, bold, and italic. The OOo predefined ''Table Heading'' paragraph style may be modified in the Styles and Formatting window, if desired.
| ||  '''TIP''' ||To directly insert a table with the default properties, click on the little arrow next to the '''Table''' icon on the Standard toolbar. A graphic appears where you can choose the table's size (rows and columns) by dragging the mouse. Holding down the mouse button over the '''Table''' icon will also display the graphic.||
+
* '''Repeat heading''' — Repeats the heading row(s) of the table at the top of subsequent pages if the table spans more than one page.<br/> ''The first ... rows'' —Specifies the number of rows to be repeated. Default is 1.
|-
+
* '''Don’t split table''' — 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 it were completely located on the following page. If the table becomes longer than would fit on one page, you will need to either de-select this check box or manually split the table.
|}
+
* '''Border''''' ''— Surrounds each cell of the table with a border. This border can be modified or deleted later.
  
 +
The '''AutoFormat''' button opens a dialog from where it is possible to select one of the many predefined table layouts. See “[[#AutoFormatting tables|AutoFormatting tables]]” on page [[#AutoFormatting tables|16]] for more information.
  
== Creating nested tables ==
+
After making your choices, click '''OK'''. Writer creates a table as wide as the page margins, with all columns the same width and all rows the same height. You can then adjust the columns and rows later to suit your needs.
:With OpenOffice.org 2.0, you can now create tables within tables (nested tables). This feature provides much more flexibility by allowing you to insert a secondary table into a primary table's cell. See Figure 3.
+
  
:To do this, click in a cell of an existing table and use any of the methods mentioned above in “Inserting a new table".
 
  
{|
+
{| class="prettytable"
| ||inline:Graphic8.png||Nested tables are new in version 2.0 of OpenOffice.org.||
+
| <center>'''Tip'''</center>
|-
+
| To directly insert a table with the default properties, click on the little arrow next to the '''Table''' icon on the Standard toolbar. A graphic appears where you can choose the table’s size (rows and columns). To create the table, click on the cell that you want to be on the last row of the last column. Holding down the mouse button over the '''Table''' icon will also display the graphic.
|}
+
  
 
 
{|
 
| ||||||||
 
|-
 
 
|}
 
|}
 +
== Creating nested tables ==
 +
With OpenOffice.org 2.0 it became possible to create tables within tables, nested to a depth only limited by imagination and practicality. Figure 3 demonstrates a simple, 2 level example.
  
:''Figure ''''1'''': Example of a nested table. The yellow-shaded table is nested in 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 “[[#Inserting a new table|Inserting a new table]]” above.
  
 +
[[Image:|thumb|''Figure 3: Nested table example. The shaded table is nested in a cell of the larger table.'']]
  
 
== Using AutoCorrect to create a table ==
 
== Using AutoCorrect to create a table ==
You can also create a table by typing a series of hyphens (-) or tabs separated by plus signs, for example +------+---+ and then pressing ''Enter''. Plus signs indicate column dividers, while hyphens and tabs indicate the width of a column. For example:
+
You can also create a table by typing a series of hyphens (-) or tabs separated by plus signs. For example, type: +------+---+ and then press ''Enter''. Plus signs indicate column dividers, while hyphens and tabs indicate the width of a column.  
 +
 
 +
For example, this character sequence:
  
 
+-----------------+---------------+------+
 
+-----------------+---------------+------+
  
This character sequence creates a table like this:
+
creates a table like this:
 +
 
 +
 
 +
{| class="prettytable"
 +
!
 +
!
 +
!
  
{|
 
| ||||||||
 
 
|-
 
|-
 +
 
|}
 
|}
  
{|
+
{| class="prettytable"
| ||  '''Note''' ||This function can be disabled or enabled in '''Tools > AutoCorrect'''. On the ''Options'' tab, deselect or select the '''Create table''' checkbox. This function does not operate when creating nested tables.||
+
| <center>'''Note'''</center>
|-
+
| This function can be disabled or enabled in '''Tools > AutoCorrect'''. On the ''Options'' tab, deselect or select the '''Create table''' check box. This function does not operate when creating nested tables.
 +
 
 
|}
 
|}
  
 +
{| class="prettytable"
 +
| <center>'''Caution'''</center>
  
= Formatting a table =
+
[[Image:]]
 +
| Always be careful when using tabs that you (a) know how wide they are set and (b) make sure that the tabs are set to the same values if used with other documents or by other users.
  
 +
|}
 +
= Formatting a table =
 
== Default parameters ==
 
== 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:
 
If you create a table using the Insert Table dialog box or the '''Table''' icon on the Standard toolbar, the following defaults are set:
Line 157: Line 205:
  
 
== Formatting individual cells ==
 
== Formatting individual cells ==
You can format each cell independently from other cells. For example, you can:
+
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.
  
* 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:
 
To change the format of a cell or range of cells:
  
# Select the cell or range of cells to be modified. You can select a single cell by clicking in it or select a range with click and drag.
+
# 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.
# Right-click the selection, or select '''Table > Table Properties''' from the menu bar.
+
# Right-click the selection and select '''Table''', or select '''Table > Table Properties''' from the menu bar.
# From the pop-up menu or the Table Properties dialog box, select the property to modify.
+
# From the Table Format dialog box, select the property to modify.
inline:Frame10.png
+
  
 +
Figure 4 shows some examples.
 +
 +
<center>[[Image:|thumb|<center>''Figure 4: 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.''</center>]]</center>
  
 
== Inserting rows and columns ==
 
== Inserting rows and columns ==
 
To insert any number of rows or columns:
 
To insert any number of rows or columns:
  
# Place the cursor in the row or column where you want new rows or columns 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 after or before the selected one.
+
# 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.
 
# Set ''Amount'' to the number of rows or columns to insert and ''Position'' to '''Before''' or'' '''''After'''. Click '''OK''' to close the dialog box.
 
# Set ''Amount'' to the number of rows or columns to insert and ''Position'' to '''Before''' or'' '''''After'''. Click '''OK''' to close the dialog box.
{|
 
| ||  '''Notes'''  ||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.<br/>Regardless of how they are inserted, new rows or columns have the same formatting as the selected row or column.||
 
|-
 
|}
 
  
  
 +
{| class="prettytable"
 +
| <center>'''Notes'''</center>
 +
| 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 ==
 
== Merging and splitting cells ==
 
To merge a group of cells into one cell:
 
To merge a group of cells into one cell:
Line 186: Line 240:
 
# Select the cells to merge.
 
# Select the cells to merge.
 
# Right-click and select '''Cell > Merge''' on the pop-up menu, or select''' Table > Merge Cells''' from the menu bar.
 
# 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:
 
To split a cell into multiple cells:
  
Line 193: Line 248:
  
 
== Merging and splitting tables ==
 
== Merging and splitting tables ==
A whole table can be split into two tables, and two tables can be merged into a single table. Tables can be split only horizontally (the top rows are put into one table, and the bottom rows into another).
+
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:
 
To split a table:
  
# Place the cursor in a cell which will be in the top row of the second table after the split (so the table splits immediately above the cursor).
+
# 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).
 
# Right-click and select '''Split Table''' in the pop-up menu. You can also use '''Table > Split Table''' from the menu bar.
 
# Right-click and select '''Split Table''' in the pop-up menu. You can also use '''Table > Split Table''' from the menu bar.
# A dialog box will pop up regarding the header. You can select ''N''''o head''''ing ''or an alternative formatting for the header (the top row of the new table).
+
# 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.
 
The table is then split into two tables separated by a blank paragraph.
  
Line 206: Line 262:
 
# Delete the blank paragraph between the tables. You must use the ''Delete'' key (not the ''Backspace'' key) to do this.
 
# Delete the blank paragraph between the tables. You must use the ''Delete'' key (not the ''Backspace'' key) to do this.
 
# Select a cell in the second table.
 
# Select a cell in the second table.
# Right-click and select '''Merge Table''' in the pop-up menu. You can also use '''Table > Merge Table''' from the menu bar.
+
# Right-click and select '''Merge Tables''' in the pop-up menu. You can also use '''Table > Merge Table''' from the menu bar.
{|
+
| ||  '''TIP'''  ||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.||
+
|-
+
|}
+
  
  
 +
{| class="prettytable"
 +
| <center>'''Tip'''</center>
 +
| 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 ==
 
== Choosing table spacing and alignment ==
 
You can specify how the table is aligned on the page and what space to leave around the table.
 
You can specify how the table is aligned on the page and what space to leave around the table.
  
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 ''Table'' tab (see Figure 3).
+
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.
  
inline:Frame6.png
+
<center>[[Image:|thumb|<center>''Figure 5: Table Format dialog box: Table page''</center>]]</center>
  
On this tab, you can:
+
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 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.)
 
* 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'':  
+
* 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.
+
* '''Left''' aligns the table with the left margin.
** '''Right''' aligns the table with the right 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.
+
* '''From Left''' lets you specify under ''Spacing'' exactly how far from the left margin the table is placed.
** '''From Right''' lets you specify under ''Spacing'' exactly how far from the right 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 distance from both left and right margins under ''Spacing''.
+
* '''Manual''' lets you specify the distances from both left and right margins under ''Spacing''.
* Under ''Spacing'':'' Above'' and ''Below'', specify the distance to leave above and below the table.
+
* Under ''Spacing'':'' Above'' and ''Below'', specify the distances to leave above and below the table.
  
 
== Specifying text flow ==
 
== Specifying text flow ==
inline:Frame5.png
+
[[Image:|thumb|''Figure 6: Table Format dialog box: Text Flow page'']]
  
On the ''Text Flow'' tab of the Table Format dialog box (Figure 4), you can:
+
On the ''Text Flow'' page of the Table Format dialog box (Figure 6), you can:
  
* Insert a page or column break either before or after the table. Use the ''Text Flow'':'' '''''Break''' checkbox, combined with the '''Page''' or '''Column''' and the '''Before''' or '''After''' buttons.
+
* 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.<br/> 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.
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'''.
  
* Keep a table on one page by deselecting the '''Allow table to split across pages and columns''' checkbox. 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''''' ''checkbox.
 
* Use the '''Repeat heading''' checkbox 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 '''Tables > Table'''.
 
{|
 
| ||  '''Note'''  ||A Table Heading row will not span two pages, but any other row will. A one-row table, 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.||
 
|-
 
|}
 
  
 +
{| class="prettytable"
 +
| <center>'''Note'''</center>
 +
| 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 ==
 
== Resizing rows and columns ==
 
You can adjust the height of rows and the width of columns in a table in several ways.
 
You can adjust the height of rows and the width of columns in a table in several ways.
Line 261: Line 318:
  
 
* Hold the mouse button down on a cell border, so a double-headed arrow appears, and and drag the border to the desired position.
 
* 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), and drag the divider to a new location.
+
* 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) 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:
+
 
 +
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.
 
* 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.
 
* 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'' tab of the Table format dialog box (Figure 5).
 
  
Right-click on the table and select '''Table''' from the pop-up menu or select '''Table > Properties''' from the menu bar. On the Table Format dialog box, select the ''Columns'' tab.
+
For greater control over the width of each column, use the ''Columns'' page of the Table format dialog box (Figure 7).
  
* '''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.
+
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.
'''Adjust columns proportionally''' results in all columns changing width when one is changed, so the proportions between them stay the same.
+
  
* ''Remaining space'' shows how much farther the table can expand before hitting the limit of the margins. This value cannot be edited.
+
* ''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. <br/> 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.
 
* 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.
inline:Frame8.png
 
  
 +
<center>[[Image:|thumb|<center>''Figure 7: Table Format dialog box: Columns page''</center>]]</center>
  
 
== Specifying table borders ==
 
== Specifying table borders ==
On the Table Format dialog box, select the ''Borders'' tab (Figure 6).
+
On the Table Format dialog box, select the '''Borders''' tab (Figure 8).
  
 
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.
 
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.
 
inline:Frame9.png
 
  
 
Borders have three components: where they go, what they look like, and how big a space is left around them.
 
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 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.
 
* ''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.
 
* ''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.
 
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.
 +
 +
<center>[[Image:|thumb|<center>''Figure 8: Table Format dialog box: Borders page''</center>]]</center>
  
 
If '''Merge adjacent line styles''' is checked, two cells sharing a common border will have their borders merged, rather than being side by side.
 
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'''  ||To reset everything if you are having problems with borders, right-click in the table and select '''Tables > Borders''' or select '''Tables > Table Properties > Borders''' and then select '''Set no ''''''borders''' under ''Line'''' arrangement'': ''Default'' (the box on the left).||
 
|-
 
|}
 
  
 +
{| class="prettytable"
 +
| <center>'''Tip'''</center>
 +
| 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 ==
 
== 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.
 
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.
Line 308: Line 368:
 
# 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.
 
# 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.
 
# Right-click and select '''Table''' from the pop-up menu, or select '''Table > Table Properties''' from the main menu.
 
# Right-click and select '''Table''' from the pop-up menu, or select '''Table > Table Properties''' from the main menu.
# In the Table Format dialog box, select the ''Background'' tab.
+
# In the Table Format dialog box, select the Background tab.
 
# 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.
 
# 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.
 
# In the ''As'' section, choose whether the background is a color or a graphic.
 
# In the ''As'' section, choose whether the background is a color or a graphic.
 
# To apply a color, select the color and click '''OK'''.
 
# To apply a color, select the color and click '''OK'''.
 
# 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.)
 
# 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'' checkbox 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''' checkbox is checked, the graphic displays in the pane above the checkbox.
 
* To apply the graphic, click '''OK'''.
 
See Figure 7 for an example of a background for a cell using an unlinked graphic which can be viewed in the Preview pane.
 
  
inline:Frame3.png
+
*
 +
** 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 Figure 9 for an example of a background for a cell using an unlinked graphic which can be viewed in the Preview pane.
  
 +
<center>[[Image:|thumb|<center>''Figure 9: Table Format dialog box: Background page''</center>]]</center>
  
 
== Vertical alignment ==
 
== Vertical alignment ==
Line 328: Line 390:
  
 
# Move the cursor to the upper left-hand cell under the table heading and click and drag to the lower left hand cell.
 
# Move the cursor to the upper left-hand cell under the table heading and click and drag to the lower left hand cell.
{|
 
| ||  '''Note'''  ||By selecting all cells, the images will also be aligned.||
 
|-
 
|}
 
  
 +
 +
{| class="prettytable"
 +
| <center>'''Note'''</center>
 +
| By selecting all cells, the images will also be aligned.
 +
 +
|}
 
# Right-click in the selected area and select '''Cell > Center''' in the pop-up menu.
 
# Right-click in the selected area and select '''Cell > Center''' in the pop-up menu.
  
Line 338: Line 402:
 
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.
 
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.'''
+
'''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.
 
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.
Line 355: Line 419:
 
# Right-click and select '''Caption''' from the pop-up menu.
 
# Right-click and select '''Caption''' from the pop-up menu.
 
# Enter the text for your caption, the numbering style, and separator.
 
# Enter the text for your caption, the numbering style, and separator.
 +
# Click '''OK'''.
 +
 
To automatically caption all your tables:
 
To automatically caption all your tables:
  
Line 360: Line 426:
 
# Right-click and select '''Caption''' from the pop-up menu.
 
# Right-click and select '''Caption''' from the pop-up menu.
 
# Select '''AutoCaption'''.
 
# Select '''AutoCaption'''.
# Select '''OpenOffice.org Writer Table''' and select the settings you want. (This dialog box is covered in more detail in Chapter 2, “Setting up Writer".)
+
# 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.
 
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:
 
Writer supplies five different category labels:
  
'''<None>'''
+
* <nowiki><None></nowiki>
 
+
* Drawing
'''Drawing'''
+
* Table
 
+
* Illustration
'''Table'''
+
* Text
 
+
'''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'''.
+
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.
 
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:
+
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 1.''' Interesting data
  
:'''Fantasia 2.''' More interesting data
+
'''Fantasia 2.''' More interesting data
  
:'''Fantasia 3'''. Yet 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.
 
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.
Line 391: Line 454:
 
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.
 
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.
+
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 ==
 
== Cross-referencing a table ==
Line 400: Line 462:
 
# Select '''Insert > Cross-reference '''from the main menu.
 
# Select '''Insert > Cross-reference '''from the main menu.
 
# Set the ''Type'' to '''Table'''. A list of captioned tables will be shown in the ''Selection'' panel; select the one you want to reference.
 
# Set the ''Type'' to '''Table'''. A list of captioned tables will be shown in the ''Selection'' panel; select the one you want to reference.
# 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.
+
# 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.
 
# Click '''Insert''' to add the cross-reference and click '''Close''' to exit the dialog box.
 
# Click '''Insert''' to add the cross-reference and click '''Close''' to exit the dialog box.
  
Line 407: Line 469:
  
 
# 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.
 
# 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.
{|
+
 
| ||  '''Note''' ||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, click '''Table > Table Properties > Background''', choose a color, and specify ''As'':'' '''''Color''''', ''''For'':'' '''''Cell'''.||
+
 
|-
+
{| class="prettytable"
 +
| <center>'''Note'''</center>
 +
| 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'''.
 +
 
 
|}
 
|}
 
 
# Position the cursor anywhere in the table and then click '''Table > AutoFormat'''.
 
# Position the cursor anywhere in the table and then click '''Table > AutoFormat'''.
# On the AutoFormat dialog box (Figure 8), click '''Add''' and give the table format a name.
+
# On the AutoFormat dialog box (Figure 10), click '''Add''' and give the table format a name in the AddAutoFormat dialog box and click '''OK'''.
{|
+
# The newly named autoformat now appears as an available format. Click '''OK''' to close the AutoFormat dialog box.
| ||  '''TIP''' ||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.||
+
|-
+
|}
+
  
inline:Frame4.png
 
  
 +
{| class="prettytable"
 +
| <center>'''Tip'''</center>
 +
| 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.
 +
 +
|}
 +
<center>[[Image:|thumb|<center>''Figure 10: AutoFormat dialog box''</center>]]</center>
  
 
== Create a heading row in an existing table ==
 
== 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'''.
 
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 ==
 
== Rotating text in a table cell ==
You can rotate text in a table cell 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'' tab, in the ''Rotation/scaling'' section, choose the rotation angle and click '''OK'''.
+
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 ==
 
== 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.
+
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.
 
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.
  
{|
 
| ||  '''Note'''  ||Turning boundaries off may not have an effect if the table has borders.||
 
|-
 
|}
 
  
{|
+
{| class="prettytable"
| ||  '''TIP''' ||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.||
+
| <center>'''Note'''</center>
|-
+
| Turning boundaries off does not hide the borders that the table may have.
 +
 
 
|}
 
|}
  
 +
{| class="prettytable"
 +
| <center>'''Tip'''</center>
 +
| 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.
  
 +
|}
 
= Data entry in tables =
 
= Data entry in tables =
 
 
== Moving between cells ==
 
== Moving between cells ==
 
Within a table, you can use the mouse, the cursor keys, or the ''Tab'' key to move between cells.
 
Within a table, you can use the mouse, the cursor keys, or the ''Tab'' key to move between cells.
  
The cursor keys move to the next cell only if there is no text in the way. For example, pressing the right cursor key will move to the right of the text in the current cell, then to the next cell.
+
The cursor keys move to the next cell only if there is no text in the way. For example, pressing the right cursor key will move the cursor to the right within the text in the current cell, then to the next 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.
 
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.
  
  
 +
{| class="prettytable"
 +
| <center>'''Tip'''</center>
 +
| To enter a ''Tab'' character as part of the text of the cell, press the ''Control'' and ''Tab'' keys at the same time.
 +
 +
|}
 
== Number recognition ==
 
== Number recognition ==
 
If number recognition is turned on, when you type a number in a table, Writer aligns it to the right of the cell and strips off any trailing zeros. For example, 4.0 is changed to 4 and aligned to the right.
 
If number recognition is turned on, when you type a number in a table, Writer aligns it to the right of the cell and strips off any trailing zeros. For example, 4.0 is changed to 4 and aligned to the right.
  
 
To turn number recognition on or off, right-click on the table and select '''Number Recognition''' in the pop-up menu.
 
To turn number recognition on or off, right-click on the table and select '''Number Recognition''' in the pop-up menu.
 
  
 
== Converting between table and text ==
 
== Converting between table and text ==
 
Writer makes it easy for you to convert from a table to text (that is, replace a table with its data) or vice versa.
 
Writer makes it easy for you to convert from a table to text (that is, replace a table with its data) or vice versa.
  
To convert plain text data into a table, select the data and then select '''Table > Convert > Text to Table''' from the main menu bar. The Convert Text to Table dialog box allows you to create a table. You must select the field delimiter (tab, paragraph marker, comma, or other printing or non-printing character) that Writer should use to divide data into different cells.
+
To convert plain text data into a table, select the data and then select '''Table > Convert > Text to Table''' from the main menu bar. In the Convert Text to Table dialog box, you must select the field delimiter (tab, paragraph marker, comma, or other printing or non-printing character) that Writer should use to divide data into different cells. Click '''OK''' to perform the conversion.
 
+
To convert from a table to plain text, select the table and then select '''Table > Convert > Table to Text'''. The data in the table is converted to plain text with the field delimiter of your choice. A space can function as a field delimiter.
+
  
 +
To convert from a table to plain text, select the table and then select '''Table > Convert > Table to Text'''. The data in the table will be converted to plain text with the field delimiter of your choice. Click '''OK''' to perform the conversion.
  
 
== Sorting data in a table ==
 
== Sorting data in a table ==
Line 478: Line 545:
 
# From the menu bar, select '''Table > Sort'''.
 
# From the menu bar, select '''Table > Sort'''.
 
# In the Sort dialog box:
 
# In the Sort dialog box:
* Decide whether you want to sort in the direction of rows or columns. Sorting by rows is the default, which sorts down the page (a list of data in a column will be sorted).
 
* Select up to three keys to sort on, in the correct order.
 
* 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'''.
 
* 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.||
 
|-
 
|}
 
  
 +
*
 +
** 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.
 +
** Select up to three keys to sort on, in the correct order.
 +
** 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'''.
 +
** Click '''OK''''' ''to perform the sort.
  
= Deleting, copying, and moving a table =
 
  
 +
{| class="prettytable"
 +
| <center>'''Note'''</center>
 +
| 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.
 +
 +
|}
 +
= Deleting, copying, and moving a table =
 
== Deleting a table ==
 
== Deleting a table ==
 
To delete a table:
 
To delete a table:
  
 
# Click somewhere in the table.
 
# Click somewhere in the table.
# Select '''Table > Delete'''''' > Table''' from the main menu.
+
# Select '''Table > Delete > Table''' from the main menu.
 +
 
 
Or:
 
Or:
  
 
# Select from the end of the paragraph before the table to the start of the paragraph after the table.
 
# Select from the end of the paragraph before the table to the start of the paragraph after the table.
# Press the ''Delete'' or the ''Backspace'' key.  
+
# Press the ''Delete'' or the ''Backspace'' key.
{|
+
| ||  '''Note'''  ||The second method also merges the paragraph after the table with the paragraph before the table, which may not be what you want.||
+
|-
+
|}
+
  
  
 +
{| class="prettytable"
 +
| <center>'''Note'''</center>
 +
| The second method also merges the paragraph after the table with the paragraph before the table, which may not be what you want.
 +
 +
|}
 
== Copying a table ==
 
== Copying a table ==
 
To copy a table from one part of the document and paste it into another part:
 
To copy a table from one part of the document and paste it into another part:
Line 522: Line 593:
 
# Move the cursor to the target position and click on it to fix the insertion point.
 
# Move the cursor to the target position and click on it to fix the insertion point.
 
# Press ''Control+V'' or click the '''Paste''' icon in the Standard toolbar.
 
# Press ''Control+V'' or click the '''Paste''' icon in the Standard toolbar.
# Return to the original table, click somewhere in it, and then select '''Table > Delete'''''' > Table''' from the main menu.
+
# Return to the original table, click somewhere in it and then select '''Table > Delete > Table''' from the main menu.
  
 
= Using tables as a page layout tool =
 
= 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 example, the Tips below are formatting as a table.
+
Tables may be used as a page layout tool to position text in a document instead of using tabs or spaces. For example, the Tips below are formatted as a table.
  
For more information and tips about using tables in page layout, see Chapter 4, “Formatting Pages".
+
For more information and tips about using tables in page layout, see Chapter 4 (Formatting Pages).
  
{|
 
| ||  '''TIPS''''''TIPS'''  ||When inserting a table used for layout, you may wish to deselect the checkboxes for '''Heading''' and '''Border''' (see Figure 2 on page ).<br/>To remove the borders from an existing table, right-click on the table, select '''Table '''from the pop-up menu, select the ''Borders'' tab (see Figure 6 on page 7), and select the icon for no borders.||
 
|-
 
|}
 
  
 +
{| class="prettytable"
 +
| <center>'''Tips'''</center>
 +
| When inserting a table used for layout, you may wish to deselect the check boxes for '''Heading''' and '''Border''' (see Figure 2 on page 3).
  
 +
To remove the borders from an existing table, right-click on the table, select '''Table '''from the pop-up menu, select the '''Borders''' tab (see Figure 8 on page 12), and select the icon for no borders.
 +
 +
|}
 
= Using spreadsheet functions in a table =
 
= Using spreadsheet functions in a table =
 
In a table in a Writer document, you can use some of the mathematical functions that are normally implemented by OpenOffice.org Calc. For many simpler functions, Writer tables can be used as a basic spreadsheet.
 
In a table in a Writer document, you can use some of the mathematical functions that are normally implemented by OpenOffice.org Calc. For many simpler functions, Writer tables can be used as a basic spreadsheet.
Line 540: Line 613:
 
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, this cell reference is displayed on the status bar (in its default position at the bottom right corner of the screen).
 
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, this cell reference is displayed on the status bar (in its default position at the bottom right corner of the screen).
  
{|
+
 
| ||  '''TIP''' ||Basic spreadsheet functions in tables are much the same as in OpenOffice.org 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>.||
+
{| class="prettytable"
|-
+
| <center>'''Tip'''</center>
 +
| Basic spreadsheet functions in tables are much the same as in OpenOffice.org Calc. <nowiki>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>.</nowiki>
 +
 
 
|}
 
|}
 +
<nowiki>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 </nowiki>Figure 11.
  
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 9.
+
[[Image:|thumb|''Figure 11: Using spreadsheet functions in a table'']]
  
 
Do the following:
 
Do the following:
  
# Click in cell <A1> and press the ''='' key. The Formula bar appears automatically, near the top of the screen. In the leftmost side of the bar, you can see the coordinates of the selected cell.
+
# <nowiki>Click in cell <A1> and press the </nowiki>'''<nowiki>=</nowiki>''' key. The Formula bar appears automatically, near the top of the screen. In the leftmost side of the bar, you can see the coordinates of the selected cell.
# Click in cell <B1>. The identifiers of this cell are automatically displayed in the Formula bar and inserted into cell <A1>.
+
# <nowiki>Click in cell <B1>. The identifiers of this cell are automatically displayed in the Formula bar and inserted into cell <A1>.</nowiki>
# Press the ''+ ''key.
+
# Press the ''+ ''key.
# Click on cell <C2>. You can see the final formula '''= <B1>+<C2>'''" displayed both in the selected cell and in the Object bar.
+
# <nowiki>Click on cell <C2>. You can see the final formula </nowiki>'''<nowiki>= <B1>+<C2></nowiki>''' displayed both in the selected cell and in the Object bar.
# Press the ''Enter'' key or click the green tick on the Formula Bar.
+
# Press the ''Enter'' key or click the green tick (checkmark) on the Formula Bar.
inline:Frame7.png
+
  
{|
 
| ||  '''TIP'''  ||To display the list of the mathematical functions that you can use in a table:<br/> 1Display the Formula toolbar by pressing ''F2'' or select a blank cell and press the ''=''  key.<br/> 2Click and hold the Formula '''f(x)''' icon.||
 
|-
 
|}
 
  
 +
{| class="prettytable"
 +
| <center>'''Tip'''</center>
 +
| To display the list of the mathematical functions that you can use in a table:# Display the Formula toolbar by pressing ''F2'' or select a blank cell and press the ''<nowiki>=</nowiki>'' key.
 +
# Click and hold the Formula '''f(x)''' icon.
 +
 +
 +
 +
|}
 
In our example, this gives the result '''9''' in the top left cell. For 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:
 
In our example, this gives the result '''9''' in the top left cell. For 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:
  
# Type an equals sign '''=''' in an empty cell.
+
# Type an equals sign '''<nowiki>=</nowiki>''' in an empty cell.
# Select the cells to be added together, in this case the cells from A2 to A5. The formula should be something like '''=<A2:A5>'''".
+
# Select the cells to be added together—in this case the cells from A2 to A5. The formula should be something like '''<nowiki>=<A2:A5></nowiki>'''.
# Press the ''Enter'' key or click the green tick on the Formula Bar.
+
# Press the ''Enter'' key or click the green tick (checkmark) on the Formula Bar.
 
# The answer appears in the cell you have selected.
 
# The answer appears in the cell you have selected.
 +
 
When using a function, you can enter the cells manually or by selecting them. Thus, to add up the four numbers that we added above (A2, A3, A4, A5), do this:
 
When using a function, you can enter the cells manually or by selecting them. Thus, to add up the four numbers that we added above (A2, A3, A4, A5), do this:
  
# Type an equals sign '''=''' in an empty cell.
+
# Type an equals sign '''<nowiki>=</nowiki>''' in an empty cell.
# Type 'sum' or select it from the function list '''f(x)'''.
+
# Type '''sum''' or select it from the function list '''f(x)'''.
# Select the cells to be added together. The formula should be something like =sum<A2:A5>".
+
# Select the cells to be added together. The formula should be something like '''<nowiki>=sum<A2:A5></nowiki>'''.
# Press the ''Enter'' key or click the green tick on the Formula Bar.
+
# Press the ''Enter'' key or click the green tick (checkmark) on the Formula Bar.
 
# The answer appears in the cell you have selected.
 
# The answer appears in the cell you have selected.
 
 
  
  
 
{{CCBY}}
 
{{CCBY}}
 
[[Category: Documentation]]
 
[[Category: Documentation]]

Revision as of 10:22, 4 August 2007

Template:NeedsWork This page was created by converting ODT to Mediawiki using Writer2MediaWiki.

This is Chapter 9 of the OpenOffice.org 2.x Writer Guide (Third edition), produced by the OOoAuthors group. A PDF of this chapter is available from the OOoAuthors Guides page at OpenOffice.org.

<< User Manuals page
<< Writer Guide Table of Contents
<< Chapter 8 Working with Graphics   |    Chapter 10 Working with Templates >>


Introduction

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

  • Technical, financial, or statistical reports
  • Product 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 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.

Tables can also be used as a page-layout tool to position text in areas of a document instead of using several Tab characters. For example, the descriptions under Figure 1 were created in a table with invisible borders. Another, perhaps better example would be in headers and footers to support independent positioning of different elements, such as page number, document title etc. This use of tables is described in Chapter 4 (Formatting Pages).

The Table menu and toolbar

Table commands are located in the main Table menu and on the Table toolbar, shown in Figure 1. Table 1 describes the functions of these commands and icons. When you create a table or select an existing table, the Table toolbar may be displayed automatically, or you can manually display the Table toolbar by clicking View > Toolbars > Table. The toolbar can float on top of the main Writer window (as illustrated in Figure 1), or it can be docked along any edge of the main window.

[[Image:|thumb|<center>
{| class="prettytable" |
1 Table
|
7 Split Cells
|
13 Insert Column
|
19 AutoFormat
|- |
2 Line Style
|
8 Optimize
|
14 Delete Row
|
20 Table Properties
|- |
3 Line Color (border)
|
9 Top
|
15 Delete Column
|
21 Sort
|- |
4 Borders
|
10 Center (vertical)
|
16 Select Table
|
22 Sum
|- |
5 Background Color
|
11 Bottom
|
17 Select Column
| |- |
6 Merge Cells
|
12 Insert Row
|
18 Select Row
| |}
Figure 1: Table toolbar
]]</center>

Table 1: Functions of the icons on the Table toolbar


Icon Name Description
Table Opens the Insert Table dialog box where you can set up and insert a table into the document, name the table for use with the Navigator, and set some options. You can also use the mouse to click the arrow at the right, drag to select the number of rows and columns to include in the table, and then release the mouse button on the last (lower right) cell.
Line Style Opens the Border Style toolbar where you can modify the border line style.
Line Color (border) Opens the Border Color toolbar where you can modify the border color.
Borders Opens the Borders toolbar where you can select sides to have a border.
Background Color Opens the Background toolbar where you can select the background color.
Merge Cells Combines the selected cells into a single cell. Refer to “Merging and splitting cells” on page 7 for an example of using this button.
Split Cells Opens the Split Cell dialog box where you can define how to split a cell. Refer to “Merging and splitting tables” on page 7 for an example of using this button.
Optimize Opens the Optimize toolbar where you can distribute the columns or rows evenly or optimize the row height or column width.
Top Aligns the contents of the selected cells to the top of the cell.
Center (vertical) Aligns the contents of the selected cells to the vertical center of the cell.
Bottom Aligns the contents of the selected cells to the bottom of the cell.
Insert Row Inserts a row below the selected row.
Insert Column Inserts a column after the selected column.
Delete Row Deletes the selected row(s) from the table.
Delete Column Deletes the selected column(s) from the table.
Select Table Selects the entire table.
Select Column Selects the column in which the cursor is positioned.
Select Row Selects the row in which the cursor is positioned.
AutoFormat Opens the AutoFormat dialog box where you can select among several predefined formatting sets. Each set is characterized by its own fonts, shading, and borders styles. You can also select AutoFormat from the Insert Table dialog box.
Table Properties Opens the Table Format dialog box where you can modify various properties for the table—for example: name, alignment, spacing, column width, borders, and background.
Sort Opens the Sort dialog box where you can specify the sort criteria for the selected cells.
Sum Activates the sum function. Refer to “Using spreadsheet functions in a table” on page 21 for an example of using this function.

Creating a table

Before you insert a table into a document, it is beneficial to have an estimate of the number of rows and columns required. However, if necessary, you can easily make changes later.

Inserting a new table

To insert a new table, position the cursor where you want the table to appear, then use any of the following methods to open the Insert Table dialog box (shown in Figure 2):

  • From the main menu, select Table > Insert > Table.
  • Press Control+F12.
  • From the Standard toolbar, click the Table icon [[Image:]].
[[Image:|thumb|<center>Figure 2: Inserting a new table using the Insert Table dialog box
]]</center>

Here you can specify the properties for the new table.

Under Name, you can enter a different name than the OOo-generated default for the table. This might come in handy in case you want the tables displayed in the Navigator in a certain (sorted) way.

Under Size, specify the initial number of columns and rows for the new table. You can change the size of the table later, if necessary.

Under Options, set up the initial table characteristics. Selecting the check boxes in this section of the dialog produces the following results:

  • Heading — Defines the first row(s) in the table as headings. The default Table Heading paragraph style is applied to the heading rows and thus makes the text centered, bold, and italic. The OOo predefined Table Heading paragraph style may be modified in the Styles and Formatting window, if desired.
  • Repeat heading — Repeats the heading row(s) of the table at the top of subsequent pages if the table spans more than one page.
    The first ... rows —Specifies the number of rows to be repeated. Default is 1.
  • Don’t split table — 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 it were completely located on the following page. If the table becomes longer than would fit on one page, you will need to either de-select this check box or manually split the table.
  • Border — Surrounds each cell of the table with a border. This border can be modified or deleted later.

The AutoFormat button opens a dialog from where it is possible to select one of the many predefined table layouts. See “AutoFormatting tables” on page 16 for more information.

After making your choices, click OK. Writer creates a table as wide as the page margins, with all columns the same width and all rows the same height. You can then adjust the columns and rows later to suit your needs.


Tip
To directly insert a table with the default properties, click on the little arrow next to the Table icon on the Standard toolbar. A graphic appears where you can choose the table’s size (rows and columns). To create the table, click on the cell that you want to be on the last row of the last column. Holding down the mouse button over the Table icon will also display the graphic.

Creating nested tables

With OpenOffice.org 2.0 it became possible to create tables within tables, nested to a depth only limited by imagination and practicality. Figure 3 demonstrates a simple, 2 level example.

To achieve this, simply click in a cell of an existing table and use any of the methods mentioned in “Inserting a new table” above.

[[Image:|thumb|Figure 3: Nested table example. The shaded table is nested in a cell of the larger table.]]

Using AutoCorrect to create a table

You can also create a table by typing a series of hyphens (-) or tabs separated by plus signs. For example, type: +------+---+ and then press Enter. Plus signs indicate column dividers, while hyphens and tabs indicate the width of a column.

For example, this character sequence:

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

creates a table like this:


Note
This function can be disabled or enabled in Tools > AutoCorrect. On the Options tab, deselect or select the Create table check box. This function does not operate when creating nested tables.
Caution

[[Image:]]

Always be careful when using tabs that you (a) know how wide they are set and (b) make sure that the tabs are set to the same values if used with other documents or by other users.

Formatting a table

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.

Figure 4 shows some examples.

[[Image:|thumb|<center>Figure 4: 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.
]]</center>

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.


Notes
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
To see clearly where the paragraphs are and to delete them easily, select View > Nonprinting Characters (Ctrl+F10) or click thebutton 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.

[[Image:|thumb|<center>Figure 5: Table Format dialog box: Table page
]]</center>

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

[[Image:|thumb|Figure 6: Table Format dialog box: Text Flow page]]

On the Text Flow page of the Table Format dialog box (Figure 6), 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.


Note
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 (Figure 7).

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.
[[Image:|thumb|<center>Figure 7: Table Format dialog box: Columns page
]]</center>

Specifying table borders

On the Table Format dialog box, select the Borders tab (Figure 8).

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.

[[Image:|thumb|<center>Figure 8: Table Format dialog box: Borders page
]]</center>

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
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 Figure 9 for an example of a background for a cell using an unlinked graphic which can be viewed in the Preview pane.

[[Image:|thumb|<center>Figure 9: Table Format dialog box: Background page
]]</center>

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.


Note
By selecting all cells, the images will also be aligned.
  1. 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.


Note
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.
  1. Position the cursor anywhere in the table and then click Table > AutoFormat.
  2. On the AutoFormat dialog box (Figure 10), click Add and give the table format a name in the AddAutoFormat dialog box and click OK.
  3. The newly named autoformat now appears as an available format. Click OK to close the AutoFormat dialog box.


Tip
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.
[[Image:|thumb|<center>Figure 10: AutoFormat dialog box
]]</center>

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.


Note
Turning boundaries off does not hide the borders that the table may have.
Tip
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.

Data entry in tables

Moving between cells

Within a table, you can use the mouse, the cursor keys, or the Tab key to move between cells.

The cursor keys move to the next cell only if there is no text in the way. For example, pressing the right cursor key will move the cursor to the right within the text in the current cell, then to the next 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 Control and Tab keys at the same time.

Number recognition

If number recognition is turned on, when you type a number in a table, Writer aligns it to the right of the cell and strips off any trailing zeros. For example, 4.0 is changed to 4 and aligned to the right.

To turn number recognition on or off, right-click on the table and select Number Recognition in the pop-up menu.

Converting between table and text

Writer makes it easy for you to convert from a table to text (that is, replace a table with its data) or vice versa.

To convert plain text data into a table, select the data and then select Table > Convert > Text to Table from the main menu bar. In the Convert Text to Table dialog box, you must select the field delimiter (tab, paragraph marker, comma, or other printing or non-printing character) that Writer should use to divide data into different cells. Click OK to perform the conversion.

To convert from a table to plain text, select the table and then select Table > Convert > Table to Text. The data in the table will be converted to plain text with the field delimiter of your choice. Click OK to perform the conversion.

Sorting data in a table

Just as in a spreadsheet, Writer allows data in a table to be sorted. Up to three levels of sorting can be specified (for example, sort first by age, then by name within each age).

To sort data in a table:

  1. Select the table (or part of the table) to be sorted.
  2. From the menu bar, select Table > Sort.
  3. In the Sort dialog box:
    • 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.
    • Select up to three keys to sort on, in the correct order.
    • 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.
    • 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.

Deleting, copying, and moving a table

Deleting a table

To delete a table:

  1. Click somewhere in the table.
  2. Select Table > Delete > Table from the main menu.

Or:

  1. Select from the end of the paragraph before the table to the start of the paragraph after the table.
  2. Press the Delete or the Backspace key.


Note
The second 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. Click somewhere in the table.
  2. From the main menu select Table > Select > Table.
  3. Press Control+C or click the Copy icon on the Standard toolbar.
  4. Move the cursor to the target position and click on it to fix the insertion point.
  5. Press Control+V or click the Paste icon in the Standard toolbar.

Moving a table

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

  1. Click somewhere in the table.
  2. From the main menu, select Table > Select > Table.
  3. Press Control+X or click the Cut icon in the Standard toolbar.
  4. Move the cursor to the target position and click on it to fix the insertion point.
  5. Press Control+V or click the Paste icon in the Standard toolbar.
  6. Return to the original table, click somewhere in it and then select Table > Delete > Table from the main menu.

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 example, the Tips below are formatted as a table.

For more information and tips about using tables in page layout, see Chapter 4 (Formatting Pages).


Tips
When inserting a table used for layout, you may wish to deselect the check boxes for Heading and Border (see Figure 2 on page 3).

To remove the borders from an existing table, right-click on the table, select Table from the pop-up menu, select the Borders tab (see Figure 8 on page 12), and select the icon for no borders.

Using spreadsheet functions in a table

In a table in a Writer document, you can use some of the mathematical functions that are normally implemented by OpenOffice.org Calc. For many simpler functions, Writer tables can be used as a basic spreadsheet.

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, this cell reference is displayed on the status bar (in its default position at the bottom right corner of the screen).


Tip
Basic spreadsheet functions in tables are much the same as in OpenOffice.org 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 11.

[[Image:|thumb|Figure 11: Using spreadsheet functions in a table]]

Do the following:

  1. Click in cell <A1> and press the = key. The Formula bar appears automatically, near the top of the screen. 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 on cell <C2>. You can see the final formula = <B1>+<C2> displayed both in the selected cell and in the Object bar.
  5. Press the Enter key or click the green tick (checkmark) on the Formula Bar.


Tip
To display the list of the mathematical functions that you can use in a table:# Display the Formula toolbar by pressing F2 or select a blank cell and press the = key.
  1. Click and hold the Formula f(x) icon.


In our example, this gives the result 9 in the top left cell. For 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 tick (checkmark) on the Formula Bar.
  4. The answer appears in the cell you have selected.

When using a function, you can enter the cells manually or by selecting 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 cells to be added together. The formula should be something like =sum<A2:A5>.
  4. Press the Enter key or click the green tick (checkmark) on the Formula Bar.
  5. The answer appears in the cell you have selected.


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