Skip to main content Skip to footer

Remove Footer that is Imported from Excel File when Printing

Background:

A user of SpreadJS, our Javascript spreadsheet API, may want to change or remove the page footer of an imported Excel file. This can be accomplished by using SpreadJS’s PrintInfo Constructor to set a new footer or set the current one to null. Below we will show how to remove the footer applied to each sheet of the workbook so that it is not seen when printing in SpreadJS.

Step 1: Function to apply changes to each sheet

Create a function that will be applied to each worksheet of the workbook when the print option is clicked.

document.getElementById('print').onclick = function () {
    spread.sheets.forEach(function (worksheet) {
                
            })
        spread.print();
    };
};

Step 2: Set footer to null for each worksheet

For this example we are using footerCenter and set it to null. Note, you can applied this same code logic for all headers and footers of SpreadJS.

document.getElementById('print').onclick = function () {
    spread.sheets.forEach(function (worksheet) {
                var pi = worksheet.printInfo();
                pi.footerCenter(null);
            })
        spread.print();
    };
};

Outcome:

After applying this code logic, the page footer imported from the Excel file is no longer observable when printing:

Mackenzie Albitz