Skip to content

Commit

Permalink
Add support for outline configuration
Browse files Browse the repository at this point in the history
- "Summary rows below detail"
- "Summary columns to right of detail"
  • Loading branch information
robinfhu committed Nov 2, 2020
1 parent eec93b0 commit f7835d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,10 @@ In addition to the base sheet keys, worksheets also add:
will write all cells in the merge range if they exist, so be sure that only
the first cell (upper-left) in the range is set.

- `ws['!outline']`: configure how outlines should behave.
Example: `{above: true}` - equivalent of unchecking the Excel option "Summary rows below detail".
`{left: true}` - equivalent of unchecking the Excel option "Summary option to the right of detail."

- `ws['!protect']`: object of write sheet protection properties. The `password`
key specifies the password for formats that support password-protected sheets
(XLSX/XLSB/XLS). The writer uses the XOR obfuscation method. The following
Expand Down
7 changes: 7 additions & 0 deletions bits/67_wsxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ function write_ws_xml_sheetpr(ws, wb, idx, opts, o) {
props.codeName = escapexml(cname);
}

if(ws && ws["!outline"]) {
var outlineprops = {summaryBelow:1, summaryRight:1};
if(ws["!outline"].above) outlineprops.summaryBelow = 0;
if(ws["!outline"].left) outlineprops.summaryRight = 0;
payload = (payload||"") + writextag('outlinePr', null, outlineprops);
}

if(!needed && !payload) return;
o[o.length] = (writextag('sheetPr', payload, props));
}
Expand Down

0 comments on commit f7835d6

Please sign in to comment.