[]
SpreadJS allows you to print a pivot table just like printing a spreadsheet. This is particularly useful when you want the printed copy of a customized pivot table for keeping records. You can set different properties, such as printDrill
, itemPrintTitles
and fieldPrintTitles
to print a pivot table with different effects.
The printDrill
option can be used to display expand or collapse buttons on the print page. The following image depicts an example of a printing pivot table with the printDrill
option.
The following code sample shows how to set the printDrill
option.
// Set printDrill option to True
myPivotTable.options.printDrill = true;
You can use the itemPrintTitles
option in case the pivot table data spills over the next page and the row labels need to be repeated on the next page. undefined
The following code sample shows how to set the itemPrintTitles
option.
// Set itemPrintTitles option to True
myPivotTable.options.itemPrintTitles = true;
Note: This option does not work in the following cases:
When the report layout is set to tabular form and the 'merge and center cells with labels' is set to true
When the report layout is set to compact form
You can use the fieldPrintTitles
option to set the print title on each page. This is helpful when there is a large number of rows and columns and you want to show headers on each page. The following image depicts an example of printing with the fieldPrintTitles
option.
The following code sample shows how to set the fieldPrintTitles
option.
// Set fieldPrintTitles option to True
myPivotTable.options.fieldPrintTitles = true;
Note: This option does not work when there are multiple pivot tables in a single spreadsheet.