protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
817 stars 417 forks source link

How to use headerrow freeze? #41

Closed forthedamn closed 7 years ago

forthedamn commented 7 years ago

Hi,I saw there was a commit named ' headerrow freeze',but I didn't find some useful information from code, could u plz tell me how to use this feature?

pietersv commented 7 years ago

@forthedamn There's a nascent feature to specify rows to repeat on print. Provide an array with start and stop indexes for the row header.

ws['!printHeader']: array of row indices for repeating row headers on print, e.g. [1:1] to repeat just the first row.

Example:

 "!ref":"A1:A59",
 "!printHeader":[1,1]

As the number of sheet attributes increases, it seems weird that these are prefaced with !, and it seems better to put them into a separate properties object. Also this isn't fully tested (e.g. what if it starts on row 3? Not sure)