Make Your Book

Create Tables

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.

 

Add or Delete Tables Using the Visual Editor

To insert a table in your book, click the table icon in the visual editor toolbar and select your desired row and column layout.

The table tool open on the chapter editor

Once you’ve selected the number of cells, the table tool will close and your table will appear. At this point you can now enter your content or style the table.

A table with six cells

To delete a table:

  1. Click anywhere inside the table
  2. Click the Table menu in the visual editor
  3. Click Delete table 

Edit Table Structure

Table menu open on the chapter editor pageOnce 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 and columns. To modify the structure of a table:

  1. Click into or select the cells, rows, or columns you wish to modify
  2. Open the table tool
  3. Hover over CellRow, or Column depending on your needs
  4. Select the action you want to occur

The Table tool allows you to edit several of your table’s properties. Table properties allow you to apply one of several predefined styles (classes), adjust the width and height of your table, adjust the cell padding and cell spacing, increase or decrease border weights, and add table captions.

Table row properties menuIf, for example, you’d like to specify that a given row should be rendered as the table header, click ‘Row -> Table row properties’ and select ‘Header’ as the row type.

Make Table Accessible

Using table headers for both rows and columns, along with the scope attribute, will enhance the accessibility of tables in your book. Clear and appropriately labeled headers provide context and structure to the table, allowing screen readers to accurately interpret the relationships between headers and data cells.

To designate table cells as header cells:

    1. Click into or select the cells you wish to designate as header cells
    2. Open the table tool
    3. Hover over Cell
    4. Select Table cell properties
    5. From the dropdown list for Cell type choose Header cell
    6. From the dropdown list for Scope choose Row or Column

Table classes from the table properties menu

Change Table Appearance

You can change the appearance of your table by clicking Table Properties and choosing an option from the Class dropdown menu. Each of the following classes defines a preset look for the table:

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

All tables default to the Standard class.

NOTE: Landscape table classes (denoted with an asterisk*) will only appear landscape in PDF format. These tables will display in ebook and webbook formats in normal portrait format.

Tables with different classes applied.

Adjust Table Width and Height

Table properties window in your chapter editorThe 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 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.

Change Border Weight

You can increase or decrease the weight of your border by changing the quantity next to Border in the Table Properties window. The default weight for the border is “1.” The higher the number, the thicker the width of your table’s external border will be.

Add a Table Caption

The table caption option can be enabled by checking the box next to Caption on the Table Properties window. When enabled, you’ll see a blank space above your table in the visual editor. Click in this space to type your table caption. 

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

Create Interactive Tables

The TablePress plugin allows you build dynamic, interactive tables which can be sorted, filtered, and searched in the webbook. These tables are exported as static tables in ebook and PDF exports.

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 plugins menu or the TablePress plugin, contact your network manager.

Once TablePress has been activated, you should see a TablePress link in your left sidebar menu. To create a table with TablePress:

    1. Click TablePress -> Add New Table from the book dashboard menu
    2. Enter your table name and an optional description of the table, then select the number of rows and columns you’d like your table to have
      The Add New Table form for the TablePress plugin
  1. Click Add Table
  2. Find the newly created table in the Table Content panel, and enter your desired data into the cells.
    Table content panel for the TablePress plugin
  3. Configure your table as desired using th Table Manipulation, Table Options, and Features panels.
    Configuration options for TablePress tables.
  4. When your table has been completed to your satisfaction, click Save Changes

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.

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 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
  3. Copy the shortcode and click OK
    TablePress shortcode
  4. Paste this shortcode into the visual editor where you want the table to appear
  5. Save the chapter

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 view the chapter.

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