"

Use the Editor

Create and Edit Tables

Displaying content in tables allows you to present complex information in a clear and accessible way. Information structured in a table is shown to enhance understanding and retention.

Pressbooks allows you to create and display information in tabular form, and to choose table styles that display your information in an attractive way in your webbook, ebook, and PDF exports.

Create a Table

  1. In the visual editor, click Table button > Table.
  2. Select the number of columns and rows via the grid.
    Table dropdown. Description above.
    ✔️ A table is inserted in the visual editor.

Add or Remove Rows and Columns

Table dropdown. Description below.

Once you’ve inserted a table in your book, you can use the Table tool to edit cell, row and column properties; merge and split cells; add and remove rows and columns; and cut, copy, and paste rows.

To add a row:

  1. Click into the row before or after which you want to add a row.
  2. Click Table button > Row.
  3. Click Insert row before or Insert row after.

To add a column:

  1. Click into the column before or after which you want to add a row.
  2. Click Table button > Column.
  3. Click Insert column before or Insert column after.

To remove a row:

  1. Click into the row you want to remove.
  2. Click Table button > Row.
  3. Click Delete row.

To remove a column:

  1. Click into the column you want to remove.
  2. Click Table button > Column.
  3. Click Delete column.

Change the Table’s Appearance

You can change a table’s appearance by editing the table’s properties. You can apply one of several predefined styles (classes) to your table, adjust its width and height, adjust the cell padding and cell spacing, increase or decrease border weights, and add table captions.

Define a Header Row

Table row properties popup. Description above.

Defining a header row for your table will make that row distinct from other rows. Should the table take up more than one page in a PDF, the header row will be repeated on the second page.

To designate a row as the table header:

  1. Click into the row you want to be the header.
  2. Click Table button > Row > Table row properties.
  3. In the Row type dropdown, click Header.
  4. Click OK.

Apply Preset Styles

Table properties > Classes dropdown. Description below.There are a number of classes (preset styles) available to assign to a table:

  • Standard
  • No lines
  • Lines
  • Shaded
  • Full Grid
  • Standard Lanscape*
  • No lines Landscape*
  • Lines Landscape*
  • Shaded Landscape*
  • Full Grid Landscape*

Note: Landscape table lasses (denoted with an asterisk *) will only appear landscape in PDF format. They will display in portrait format in the ebook and webbook versions of your book.

Class: Standard
Apple Banana
Carrot Date
Class: No Lines
Apple Banana
Carrot Date
Class: Lines
Apple Banana
Carrot Date
Class: Shaded
Apple Banana
Carrot Date
Class: Full Grid
Apple Banana
Carrot Date

To apply a preset style to your table:

  1. Click into the table you want format.
  2. Click Table button > Table properties.
  3. In the Class dropdown, select the class of your choice.
  4. Click OK.

Adjust Table Width and Height

Table properties window. Description below.The width of your table can be set as a percentage or pixel value. Tables with percentage widths will be responsive to the size of their container, while tables with pixel widths will be will be fixed. By default, the width of your table will be set at 100%. This means that the table will take up the entire width of its parent element (typically, the page) and end at the left and right margins. You can increase or decrease your table’s width by changing the percentage or pixel value.

⚠️ Table width and height apply to all formats of your book. If you set your table width in pixels, your table might spill over your PDF page.

Table height can only be expressed in pixels. If you attempt to set a height value that is too small for the number of rows in that table, your value will be replaced by a safe default. If you increase the table height, the height will be distributed equally to all rows, unless row heights have been specified separately.

Add a Table Caption

To add a caption to your table:

  1. Click into the table you want format.
  2. Click Table button > Table properties.
  3. Select Caption.
  4. Click OK.
    ✔️ A blank space appears above your table.
  5. Click in this space and type your table caption.

Table in visual editor with caption. Description above.

Table captions will display below your table in your Pressbooks webbook and above the table in ebook and PDF export files.

Make Your Table Accessible

Tables need a properly defined structure to be accessible.[1] This means adding row and column headers to define the different sections of table contents. Screen readers read tables horizontally—cell by cell, row by row—and row and column headers help give context to the data in each cell.

To create column headers:

  1. In your table, select all the cells in the first row.
  2. Click Table button > Cell > Table cell properties.
  3. In the Cell type dropdown, click Header Cell.
  4. In the Scope dropdown, click Column.
  5. Click OK.

If your table has row headers:

  1. In your table, select all cells that will be row headers.
    This should be all cells in the first column of your table, except for the cell in the first row, which has already been marked as a column header.
  2. Click Table button > Cell > Table cell properties.
  3. In the Cell type dropdown, click Header Cell.
  4. In the Scope dropdown, click Row.
  5. Click OK.

Delete a Table

  1. In the visual editor, click anywhere inside the table
  2. Click the Table menu in the editor toolbar
  3. Click Delete table 

Create Interactive Tables with TablePress

TablePress is a plugin that allows you to build dynamic, interactive tables which can be sorted, filtered, and searched in the webbook. These tables are exported as static tables in EPUB and PDF exports.

TablePress also allows you to import CSV, HTML, JSON, XLS, or XLSX files and convert their tabular data into TablePress tables and export tables you’ve created to your device as CSV, HTML, or JSON files.

Activate the TablePress plugin

In order to create these tables, the TablePress plugin must be installed on your network and activated in your book. If your network allows book admins to activate installed plugins in their books, you can do so by clicking Plugins from the left sidebar menu, and activating TablePress from the plugins list. If you do not see the Plugins menu item or the TablePress plugin, contact your network manager.

Once TablePress has been activated, you should see a TablePress item in your left sidebar menu.

Create a table with TablePress

To create a table with TablePress:

  1. Click TablePress > Add New Table from the book dashboard menu.
    TablePress menu items: All Tables; Add New Table; Import a Table; Export a Table; Plugin Options; About TablePress
  2. Type a table name and (optional) a description of the table, then select the number of rows and columns you’d like your table to have.
    The Add New Table box with textboxes for Table Name, Description (optional), Number of Rows, Number of Columns
  3. Click Add Table.
    The edit page for the newly created table opens.
  4. Add content to the cells of your table.Table Content panel with editable cells for row and column content
  5. Configure your table as desired using the Table Manipulation, Table Options, and Features boxes.
    • The Table Manipulation box allows you to insert links and images into cells and to edit cells with the Advanced Editor. You can combine cells or rows (use with caution as this reduces the table’s accessibility). You can choose which rows or columns to hide and you can duplicate, insert or delete rows.Table Manipulation box. Description above.
    • The Table Options box has options to designate a table head row and/or a table foot row, to display alternating row background colors, to highlight a row the mouse hovers over, to display the table name above or below the table, to show the table description above or below the table, and to add additional CSS classes for the table.
      Table Options box. Description above.
    • The Features of the DataTables JavaScript library box offers the option to use the DataTables JavaScript library with the table. If activated, sorting, search/filtering, pagination, information display and horizontal scrolling options become available. The box also allows you to add custom commands.
      Features of the DataTables JavaScript library box. Description above.
  6. Scroll to the bottom and click Save Changes.

Add TablePress Tables to a Chapter

All TablePress tables will be given a shortcode upon creation. These shortcodes follow a predictable pattern: [table id=<ID> /] where <ID> is the number of a particular table (IDs are assigned to tables in the order of their creation within your book). To insert a TablePress table into a chapter:

  1. Click TablePress > All Tables and find the table you’d like to place in the chapter.
  2. Hover over the title of your table, then click Show Shortcode.
    A window with the shortcode will pop up.
  3. Copy the shortcode and click OK.
  4. Navigate to the chapter where you want the table to appear.
  5. Past the shortcode into the visual editor.
  6. Click Save.

The table won’t display in your visual editor; you’ll just see the shortcode. However, the table will appear in your webbook when you preview or view the chapter.


  1. These instructions are adapted from the Accessibility Toolkit - 2nd Edition by Amanda Coolidge; Sue Doner; Tara Robertson; and Josie Gray. In the chapter on Tables you can find additional information on how to improve your table's accessibility.

License

Icon for the Creative Commons Attribution 4.0 International License

Pressbooks User Guide Copyright © 2024 by Pressbooks is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book