Selecting Styles for Table Cell Contents

There are a couple of different ways to use styles to affect the look of tables that you insert. First, you can use standard table styles (e.g., table, td, th, tr). You can modify these styles in your regular stylesheet. A second option is to use the custom table stylesheets that Contributor lets you create. These table stylesheets let you create patterns and different looks for tables. For more information about both kinds of stylesheets, see Styles and Stylesheets.

When you insert a table, it is set up by default to use standard table tags in the individual cells (e.g., <th> for table headers, <td> for regular table text). However, if you press ENTER at the end of a line, a <p> tag is added within the standard tag. Therefore, in order to keep all of the content in your table cells looking consistent, there are a couple of things you can do. First, if you are editing table styles in a regular stylesheet, you can create advanced selectors (e.g., "td p"). Second, you may want to create a special style class of the p style to be used for table content (e.g., p.tabletext) and apply that style to all of your cells when you first create a table. You can manually apply specific styles to tables by selecting the table cells, clicking Table > Cell Content Style, and choosing the style to be used for those cells.

Example If you keep the default table styles, you will see something like this:

If you select all of the regular body rows in a table, open the Table Cell Content Style dialog, and select a p style class, those cells will have that p style within a td style, like this:

How to Manually Select Styles for Table Cell Contents

  1. Open the document or topic.
  2. Select the table cells for which you want to use a certain style.
  3. Select Table > Cell Content Style. The Table Cell Content Style dialog opens, displaying the available paragraph styles in your stylesheet.
  4. From the list, select the style that you want to use for the selected cells. If you select (none), any paragraph style applied will be removed from those cells.
  5. Click OK.
  6. Click Save the active file. to save your work.

However, rather than repeating all these steps each time you create a table, the easiest way to accomplish this is to set a default cell content style. You can do this in a couple of ways: globally or using a table stylesheet.

Global Style Method

When you select Table > Cell Content Style, you can select the style you want and click the Set as default check box.

Then when you insert a new table, the cells will already have the default style that you set, so you don't need to select that style each time you create a table. This is a very quick and easy solution. However, keep in mind that it is a global setting for all types of rows and all columns in every new table that you insert. For example, if you choose p.tabletext as the default in this dialog, that style will automatically be initially set for all table header, body, and footer cells when you create a table. So if you want different styles for the different parts of the table, you will need to manually replace the default style in those table cells afterward.

If you use this method, none of the existing tables that you've already created and formatted are affected by the default setting. The default style is applied automatically only to new tables and new table cells that are created.

Table Stylesheet Method

You can set defaults in your table stylesheets in the Cell Content Style section of the Table Style Editor. In the Tag field, select the parent style (p). Then in the Class field, either select a style class from the drop-down or type it directly in the field (e.g., TableRowText).

Default table cell styles can be set for any of the following: headers, rows, columns, and footers. In addition, you can have different defaults for each table stylesheet.

Then when you insert a new table using a particular table stylesheet, the various parts of the table (e.g., header, row, footer) will automatically start out with the appropriate styles so that you don't have to set any of them manually.

This feature automatically applies the selected style class only in new tables (and in new cells within existing tables) that are associated with the table stylesheet. It does not affect existing tables.

If you also have a style set in the Table ribbon using the global method, your settings in a table stylesheet override that style.

For more information, see Table Stylesheets and Editing Table Stylesheets.

What’s Noteworthy?

Note This feature is not supported for MadCap Lingo review package (LIREV) files.