Make Your Book
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.
To insert a table in your book, click the table icon in the visual editor toolbar and select your desired row and column layout.
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.
To delete a table:
- Click anywhere inside the table
- Click the Table menu in the visual editor
- Click Delete table
Edit Table Structure
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 and columns. To modify the structure of a table:
- Click into or select the cells, rows, or columns you wish to modify
- Open the table tool
- Hover over Cell, Row, or Column depending on your needs
- 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.
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:
- No lines
- Full Grid
- Standard Lanscape*
- No lines Landscape*
- Lines Landscape*
- Shaded Landscape*
- Full Grid Landscape*
All tables default to the Standard class.
Adjust Table Width and Height
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 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.
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:
- Click TablePress -> Add New Table from the book dashboard menu
- 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
- Click Add Table
- Find the newly created table in the Table Content panel, and enter your desired data into the cells.
- Configure your table as desired using th Table Manipulation, Table Options, and Features panels.
- 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:
- Click All Tables and find the table you’d like to place in the chapter
- Hover over the title of your table, then click Show Shortcode
- Copy the shortcode and click OK
- Paste this shortcode into the visual editor where you want the table to appear
- 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.