Table tools you can use in wpDataTables

Video versionA video overview of table tools in wpDataTables

Table toolswpDataTables Toolkit for exporting

Table Tools consists of a block of buttons that provides additional features for the tables: export to PDF, export to CSV, export to Excel, print view, toggle for column visibility for front-end users, etc.

Table tools in wpdatatables
Export buttons

These functionalities are based on a 3rd party HTML5 library. There are some limitations in this library we will emphasize for your awareness:

Show all entries option
  • For tables with server-side processing, only the visible rows will be exported to any format. If you want the entire table to be exported (or copied to a clipboard), you need to choose the “Show All” feature in the “show … entries” block, and then do the export:
  • Table Tools are not included in Simple Tables, so you will not be able to use them there
  • Generated PDF, XLS, and CSV are not customizable. Unfortunately, the library allows very little “fine-tuning” of the generated files, so the font, size, and other properties cannot be changed (but the title can – see below).
  • Conditional formatting is not reflected in any of generated export files.
  • Other front-end extensions cannot be combined with Table Tools. If you have row grouping enabled for the table, or there are some customizations you did yourself, they won’t be reflected in the generated Excel, CSV, or PDF document, nor in the clipboard.
  • When you export tables with the wpDataTables plugin, please note that you can export values, but not formulas. WpDataTables doesn’t support exporting formulas, so a Formula column will be exported only with values; and any calculations of Average, MIN, MAX, and Total will not be exported at all.
  • Exporting images is not possible at the moment, but you are able to export them as HTML with the new “Include HTML” option.
  • You can’t export columns that are hidden – they will not be visible in any exporting or printing tool.
  • Export numbers with commas as decimal separators have issues in the Excel report. Please use the CSV export button or change the column type to string for these columns.

Copy to clipboardTool for copying table content

The Copy button triggers the “copy to clipboard” function, so it copies all the rows that exist in the page to your OS clipboard, and you can later paste it into some other software. Once you click it, you get a popup with a notification on how many rows were copied to the clipboard, e.g., “Copied 20 rows to the clipboard”. All the rows are copied to the clipboard, including the tab-separated headings. You can then paste it to MS Excel for example. For tables with server-side processing enabled, only the visible columns are copied.

Copy to clipboard view

PDF exportTool to generate a PDF file with the table content

Export data from table in PDF

The “PDF” button generates a new PDF document from the table and calls the browser’s “Save as …” dialog so you can choose a path for your file. It is a very basic PDF document, with the page title, and the table with simple formatting:

For tables with server-side processing enabled, PDF will contain only the visible rows.

From version 3.6 it is available new options for customization of PDF reports layout:

  1. Page orientation – Here you can set portrait or landscape orientation. By default is set on portrait.
  2. PDF Paper Size – Here you can choose one of the paper sizes: A3, A4, A5, Legal, Letter and Tabloid. By default is set on A4.

CSV exportTool for saving table content in a CSV file

Export table data in CSV

The “CSV” button generates a new file that can be opened in a browser or third party spreadsheet editing software, like Libre office. If it is opened in a browser, the file will be in the “Comma-Separated-Values” format out of the table and calls the browser’s “Save as …” dialog so you can choose a path for your file. All the values from your table will be exported including the headers. The cells will be separated by commas, and rows will be separated by line breaks:

For tables with server-side processing enabled, the CSV file will contain only the visible rows.

Print buttonTool for printing the table content

The “Print” button uses jQuery functionality to hide all the elements on the page except for the table. The results may look weird for some themes, but it will work correctly for most, and make the view of the page “printable”.

Excel exportTool for exporting table content to an Excel file

The “Excel” button generates an Excel file with the visible table data that is not customizable. If you want to generate customized Excel or Word files with the table content, check out the Report Builder addon.

Column visibilityTool to allow front-end users to toggle column visibility

Column visibility example

If this button is turned on for the table, your front-end table users will be able to toggle the visibility of the table’s columns. Please note that it also includes the columns that you’ve hidden from the back-end. You can un-select the button to hide the column and select it back to show it.

Configuring Table ToolsHow to customize which tools will be added for a table

table-tools-1

You can configure which buttons will be included in the Table Tools block separately for each table. To enable/disable the Table Tools block you can toggle on or off the Table Tools switch in the table configuration.

If the Table Tools are enabled, you can open the dropdown with buttons list to define which buttons to include.

table-tools-2

The default export filename will be derived from the table title. To change the export filename and the displayed title, add an ‘export_file_name’ attribute to the table shortcode. For example, if you define the shortcode like:

[wpdatatable id=1 export_file_name='My Export File']

The filenames of exported files will be: “My Export File.pdf”, “My Export File.xls”, etc.

NEW! The “Include HTML” option will allow you to export columns that contain HTML (such as link, image, email, attachment, or HTML). They will be rendered as HTML in the exported files of the CSV, Excel, Print, and Copy options.

This option is currently not available for the PDF export option.

Please note that you should check this functionality on the front-end since if you use this option in the back-end the buttons in headers will be rendered as HTML as well.

export-html