Creating and Formatting Tables: in This Chapter
Creating and Formatting Tables: in This Chapter
11
IN THIS CHAPTER
Using Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating Writer Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Formatting Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Adding and Managing Rows and Columns . . . . . . . . . . . . . . . . . . . . . . . . . . Creating and Applying AutoFormats: The Table Formatting Timesaver. . . . Converting Between Text and Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automatic Number Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sorting Data in a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Doing Calculations in Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
page 178 page 178 page 182 page 189 page 193 page 195 page 198 page 199 page 201
177
178
Using Tables
Sometimes you just need a document with standard text and pictures, one after another. You have a paragraph, a list, a picture, and so on. That ends pretty quickly when you get anything remotely complicated, or if you need to cram a lot of information onto a page. Its also time for a new approach if you want to be able to easily compare information side by side. Anytime you want to control visually where pieces of text go, when youve got lots of data to present in one spot, or if want to be able to do a little math with your numeric data, tables are a great idea. Its also a good idea to use tables when you have two columns of information that need to be side by side, and there are two or more rows in the first column.
Tables are good for straight-up financial figures, since you can easily compare the data, and you can apply automatic currency formatting. Tables let you arrange different pieces of information for particular topics, as shown. In this and the above example, you also see some options for shading and border formatting.
Tables are an excellent approach for information like the example at left. Just use a table, and take off the borders. You will drive yourself crazy if you try to do this with tabs or wrapping text.
179
Inserting a Table
There are a couple approaches to inserting a table.
Choose Insert > Table. In the Insert Table window, specify the number of columns and rows. (This includes the header row.) If you dont want a header, unmark it.
If you want to apply an Autoformat, click the Autoformat button and make your selection. (For more information, see Creating and Applying AutoFormats: The Table Formatting Timesaver on page 193.) Click OK. The table will appear in the document. Fill in the table as needed. You can press Tab to move from cell to cell (Shift + Tab to move back).
4 5 6
Creating a Table Using the Insert Menu or the Insert Table Icon
You can also insert a table by choosing Insert > Table. Another option is to display the Insert toolbar. Click and hold down on the Insert Table icon and select the number of rows and columns.
180
Choose Insert > Table. In the Insert Table window, select or unmark the Heading option.
3 4 5
To have multiple heading rows, specify the number of heading rows; these rows will repeat on each page. Specify the number of standard rows and other options, as usual. Click OK.
181
Deleting a Table
Heres one approach.
1
Select the first line above the table, as well as the entire table.
Another approach is to select the whole table and click either the Delete Row or Delete Column icon.
The spreadsheet looks like this when you paste it into Writer, then double-click it.
182
If youve got a lot of numeric data, or things that would be better done in a spreadsheet, then just do it in a spreadsheet. Then copy and paste the data into the Writer document. You can copy some or all of a spreadsheet. When you paste it into Writer, it looks just like plain data; any borders you apply will come over, but if there arent any borders, you dont see any. When you double-click in the spreadsheet data in Writer, then it looks like a spreadsheet.
Plain Pasting
Copy the part of the spreadsheet you want to copy, then go to the other document and choose Edit > Paste to simply paste the spreadsheet.
That means the pasted information will be updated every time you change the data in the spreadsheet. This is particularly nice if you need data from a spreadsheet to be included in several different documents. This works when you paste from a spreadsheet into a Writer document, and when you paste from a spreadsheet into another spreadsheet.
Formatting Tables
You can format many aspects of a tablethe background, borders, border styles, and so on. Theres a specific toolbar, the Table toolbar, that helps you do much of that.
Click in a table. Be sure that the Table toolbar appears. If it doesnt, choose View > Toolbars > Table.
Formatting Tables
183
Be sure you can see the table formatting toolbar. Refer to Viewing the Table Formatting Bar on page 182 if you dont see it.
Click on the borders icon and hold your mouse down on it. Select the blank option, to clear the current borders, before you apply other borders.
Whenever you switch where the borders are placed, you have to clear the old borders first by selecting the blank option. Then select a new border placement option.
184
With the table still selected, click and hold down the mouse again on the borders icon and select the icon for the formatting you want.
1 2
Select the table to change line styles for. Be sure the table toolbar is displayed.
Formatting Tables
185
Click and hold down your mouse on the Border Style icon.
4 5
Select a border type you want. The table will reflect the change.
186
1 2
Select the table, and be sure you can see the table formatting bar. Click and hold down the mouse on the Background icon.
3 4
Formatting Tables
187
Very few people would, of course, since its not that attractive. But the point is, how do you apply specific border formatting to each border in a table? To have more control over border formatting, youll want to use the Table Format window. Select the table and choose Table > Table Properties.
Borders Tab
You can use the presets but you can also click on each line in the border area. Clicking on a line in the User-Defined border area will switch it from selected to deselected
Give the text some spacing using these fields. Specify the border style and color here, for the currently selected line in the User-Defined field, or for the selected Default borders.
Click on a line in the UserDefined area, then select color, style, and other options.
Specify the shadow, direction, and distance from the border, here. The shadow is for the whole table, not per line.
188
When you select a line in the User-Defined area, or when you choose a preset Default pattern, heres what it translates into in a table.
Only the top border
Only the far-left border All interior vertical borders Only the far-right border
What about Merge Adjacent Line Styles? This option in the Borders tab merges two different
border styles of adjacent cells in a Writer table into one border style. This property is valid for a whole table in a Writer document. The rules can be condensed to the statement that the stronger attribute wins. If, for example, one cell has a red border of 2 point width, and the adjacent cell has a blue border of 3 point width, then the common border between these two cells will be blue with 3 point width.
Background Tab
This doesnt provide all that much additional value, but you can apply the formatting to the cell, row, or whole table. You can also choose a background color or background graphic for the cell, row, or table
189
Be sure you can see table toolbar; if you cant, choose View > Toolbars > Table. Click in the row above where you want a new row.
Click in the row you want to delete, or select rows to delete, and click the horizontal icon.
Select the entire table and position your cursor over the line on the ruler where you want to change the width of a column. Make sure the cursor turns into a two-ended arrow, as shown.
190
Drag the column separator to the left or right to change the width.
This will also work if you move your mouse over the table itself; when the icon looks like this, drag the border left or right.
Select the table. Choose Table > Table Properties. Click the Columns tab.
4 5
191
Be sure you can see the table toolbar; if you cant, choose View > Toolbars > Table. Youll be using the Optimize icon in this procedure, and the options available when you long-click on it. You can distribute the columns evenly, or simply optimally for the content. To make columns equal, click and hold down on the Optimize icon and select the Distribute Columns Evenly icon. The columns will be resized equally.
In the table toolbar, click and hold down on the Optimize icon and select the Optimize Width icon. The column widths adjust to the minimum width the need to display all text on one line.
192
193
In the resulting window, select the correct number of cells and specify vertical split. Dont just accept the default; its usually incorrect
Click OK.
Creating an AutoFormat
1
2 3
Select the entire table. (In Calc, select at least three cells across and two down.) Choose Table > AutoFormat. (In Calc, choose Format > Autoformat.)
194
In the Add AutoFormat window, type a name for the format. Click OK.
Click OK.
195
2 3 4 5
Choose Tables > Autoformat. The AutoFormat window will appear. In the Format list, scroll down and select the AutoFormat you want. Click the More button at the right side. Unmark or mark any options you want to change.
6 7
196
Select the text. The text needs to be separated with tabs or another separator so that Writer can tell where the columns will go.
2 3
Choose Table > Convert > Text to Table. The conversion window will appear.
4 5 6
Select the item that separates the columns, such as a tab, and set other options such as whether you want a heading row. Click OK. The text will be converted to a table.
197
Select the entire table. Choose Format > Convert > Table to Text. The conversion window will appear. Leave the values as is, or change the separator item.
Click OK.
Copy the portion of the spreadsheet that you want to turn into a table. Move to a Writer document. Choose Edit > Paste Special and select Formatted Text. Click OK.
You can also click and hold down on the Paste icon and paste as Formatted Text.
4
The text will appear as a table, but without borders. Select all the text and the table toolbar will appear. Apply a border if you want one on the table. See Adding or Removing Table Borders on page 183.
198
Open the document with the table containing numbers. Select the numbers (not the heading) in the numbers column and right-click on that column. Choose Number Format. In the Number Format window, in the Category list, select the number format you want such as Currency. Then in the Format list, select the variant that you want.
In the Options area, specify the number of decimal places, if you want to change the default settings, and how negatives are displayed.
5 6
199
Open the document and select the table, without the headings.
Be sure that in the Direction area, Rows is selected. You typically want to sort the rows of data, so that the rows are re-ordered, so this is correct.
200
Be sure the Key 1 item is selected. Key 1 just means the first thing to sort by. Then in the Column list, type the number of the column you want to sort by. In the example shown earlier, if you wanted to sort by price, you would select Column 3.
Then choose whether to sort by Alphanumeric or Numeric, and Ascending or Descending. You must choose Numeric to sort numbers.
6 7
If you want to sort by another column now, select Key 2, and select the column and options for that sort. Click OK. The data will be sorted.
201
If you have problems sorting numbers, select all the number cells, right-click, choose Number Format, and be sure that theyre a number or currency format rather than Text. If your numbers are left-aligned in the table, theyre not the right format. See Automatic Number Formatting on page 198 for more information
If you want to apply number formatting, see Automatic Number Formatting on page 198. Click in the table, where you want the calculation result to appear.
Type the calculation. Use <> around the cell references. The first cell in the first row and column is A1, and so on.
5 6
Click the check mark icon. The calculation result will appear in the table cell.