Add support for outline configuration

- "Summary rows below detail"
- "Summary columns to right of detail"
This commit is contained in:
Robin Hu 2020-11-02 16:45:11 -05:00
parent eec93b0b85
commit f7835d67b2
2 changed files with 11 additions and 0 deletions

@ -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

@ -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));
}