d-band / better-xlsx

A better xlsx library.
https://d-band.github.io/better-xlsx/
421 stars 36 forks source link

not show headerfooter when print. #84

Closed angela-1 closed 5 years ago

angela-1 commented 5 years ago

I user this library to generate xlsx file. When i want to print the xlsx to paper.I saw the header with "sheetname" and footer with "page 1".

what i expected is default not to show the header and footer. I need to modify the xlsx file by hand before i print it.

Maybe you can give user a config item. Many thanks!

helloyou2012 commented 5 years ago

@angela-1 you can do it like this:

const xlsx = require('better-xlsx');

const file = new xlsx.File();
const sheet = file.addSheet('Sheet 1');
sheet.afterMake = (xsheet) => {
  xsheet.headerFooter.oddHeader = '';
  xsheet.headerFooter.oddFooter = '';
};
angela-1 commented 5 years ago

Many Thanks!