SpreadJS 14
Features / Pivot Table / Pivot Table Print
In This Topic
    Pivot Table Print
    In This Topic

    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 printing pivot table with the printDrill option.

    Setting pagedrill option

    Refer to the following example code to set the printDrill option.

    Javascript
    Copy Code
    // 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. The following image depicts an example of printing with the itemPrintTitles option.

    Setting itemPrintTitles option

    Refer to the following example code to set the itemPrintTitles option.

    Javascript
    Copy Code
    // 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 are 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.

    Setting fieldPrintTitles option

    Refer to the following example code to set the fieldPrintTitles option.

    Javascript
    Copy Code
    // 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.