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

Grouping #52

Open justinmasse opened 7 years ago

justinmasse commented 7 years ago

Is there anyway to provide 'grouping' to the xlsx? Allowing collapse and expand behavior.

justinmasse commented 7 years ago

For example. image

st-sloth commented 7 years ago

As with freezing (#51), I started working on it, however haven't yet opened a PR because I'd prefer for the freezing one to resolve first. But I need both features in production so there is branch that has both, that you too can use. Currently this branch doesn't have documentation on row grouping and just uses ws['!rows'] which is an array of objects, and maps all the properties from the objects to xml attributes of row elements. And the attribute you need is outlineLevel as in

ws['!rows'] = [
  undefined,
  { outlineLevel: 1},
  { outlineLevel: 2},
  { outlineLevel: 2},
  { outlineLevel: 1}
];