The library that we use to generate PDF exports in Scroll PDF Exporter v4.x, differs to that used by the native Confluence exporter and our previous version of the app, Scroll PDF Exporter v3.x.
Therefore, in comparison, Confluence tables are processed differently during the export and this page explains how tables are handled in Scroll PDF Exporter v4.x.
Table behavior overview
Confluence table formatting
When adding a table to Confluence you have two options available to define how table columns are formatted. These are:
- Responsive: Table columns get wider as you add content. Users can drag column borders on the page to set the column widths relative to one another.
- Fixed width: Users can drag column borders to set the width. The table always appears with the width you set.
These two settings are found in the Confluence toolbar when editing a table:
Depending on the table option you have selected on your page, this will impact how the table is exported by Scroll PDF Exporter v4.x.
How Responsive tables are handled
If you add a responsive table to your Confluence page and either don't change the column widths, or decide to manually adjust the column widths, within the page storage format width values for the columns will be automatically calculated and added to the HTML code in the page storage format.
Once either method has been used to input the table on the page, the table in the corresponding export will use the whole width of the PDF page (with the relative Confluence column width still being applied):
How Fixed Width tables are handled
In order to export tables that only take up the amount of space in the PDF export, relative to what is shown in the Confluence online view, you can apply the Fixed Width table format.
The table below has the Fixed Width format applied:
This results in the following table being rendered in the PDF export when using the bundled Article template:
In this export example, the column widths rendered in the PDF match those in the Confluence online view.
However, due to the font and table padding settings applied in the the export template, the header text remains on one line and is not wrapped like in the Confluence page view. This is because the bundled Article export template applies a different font style and size in comparison to what is displayed in the Confluence editor.
Unexpected export results
When exporting table content, generated PDF exports may sometimes not appear as expected. This can be caused by different factor but it is important to consider that;
- the online Confluence page view offers more space in a dynamic view (scrollable browser), which differs to the defined space set in a PDF file. Therefore, word/line breaks have to occur in PDF exports so that content does not run off the page.
- browsers can display HTML content differently, for instance rendering fonts wider than what the export will render.
Incorrect word breaks in table cells
Incorrect word breaks can occur in exported tables, irrespective of the format applied (ie. Responsive or Fixed Width). For instance, a Confluence page could look like this:
But the export with the bundled Article template looks like this:
This export behavior occurs because of;
- the number of columns included in the table
- the size of the font used for the table cell content
- the amount of table padding applied to the table header/body cells
In order to prevent this export behavior from occurring you can reduce the size of the font and/or table cell padding in the export template.
Alternatively, you can add the Scroll Table Layout macro prior to the affected table on your Confluence page to modify how the specific table is exported – such as changing the page orientation or defining the specific table column widths.
Template styling not applied
Sometimes formatting not defined in the export template can be rendered in the export. Most notably, this can occur if the table was imported into Confluence, such as via copying and pasting from an external source. In such cases, hidden code from the external source can be retained in the storage format of the Confluence page and cause unexpected export results.
For instance, the table may appear normally in the Confluence online page view:
But when the export is performed, the desired blue table header cell background from the template is not applied to all header cell elements – the header text content incorrectly displays a grey background:
This is caused by hidden HTML background color codes being applied to the header cell text:
To fix this, and similar styling issues, you can either re-add the table content using the standard Confluence editor tool, or, use the free Confluence Source Editor to edit the page storage format.