• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Sorting a Table

You can perform a simple table sort by sorting on the contents of a single column. You can also perform a more complicated sort by sorting on the contents of two columns. You cannot sort tables that contain merged cells. The following exercise demonstrates sorting.

1.
In the lodging.html document, select the table and then choose Commands > Sort Table.

The Sort Table dialog box opens.

All the default settings will work for this exercise. The first row in the table contains the column headers; you don't want to sort them. (Note that not including the first row is the default option because the check box is initially unchecked.)

2.
Set the following options.

Sort By: Select the column to sort. For this exercise, select the first column.

Order: Specify whether you want to sort the column alphabetically or numerically. For this exercise, select Alphabetically. This option is important when the contents of a column are numerical. An alphabetical sort applied to a list of one-and two-digit numbers results in an alphanumeric sort (such as 1, 10, 2, 20, 3, 30) rather than a straight numeric sort (such as 1, 2, 3, 10, 20, 30). Choose Ascending (A to Z or low to high) or Descending for the sort order.

Then By: For this exercise, leave this blank. Then By lets you choose to perform a secondary sort on a different column. The sort methods in the menu are the same as the methods that are available in Sort By.

Sort Includes First Row: Choose this option to include the first row in the sort. If the first row is a heading that shouldn't be moved (as it is in this exercise), leave this check box unchecked. For this exercise, leave this unchecked.

Keep TR Attributes with Sorted Row: If you changed any attributes for a row, you can retain that attribute in the row by choosing this option. Suppose that you sort a table with a color in the first row. After sorting, the data in the first row moves to the second row. If Keep TR Attributes with Sort Row is selected, the color moves with the data to the second row. If this option is not selected, the color remains in the first row. For this exercise, leave this unchecked.

3.
Click Apply or OK.

The table is now sorted alphabetically using the data in the first column, but the row headers remain in the first row. Save your document.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint