From 03b755b3aed45422155c5d329260addf97439065 Mon Sep 17 00:00:00 2001 From: Pieter Sheth-Voss Date: Fri, 4 Dec 2015 09:49:11 -0500 Subject: [PATCH] Add showGridlines --- README.md | 2 ++ bits/67_wsxml.js | 7 +++++++ package.json | 2 +- xlsx.js | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3abc657..3c6e273 100644 --- a/README.md +++ b/README.md @@ -488,6 +488,8 @@ The exported `write` and `writeFile` functions accept an options argument: | cellDates | false | Store dates as type `d` (default is `n`) | | bookSST | false | Generate Shared String Table ** | | bookType | 'xlsx' | Type of Workbook ("xlsx" or "xlsm" or "xlsb") | +| showGridLines | true | Show gridlines on all pages | +| tabSelected | '1' | Initial tab selected | - `bookSST` is slower and more memory intensive, but has better compatibility with older versions of iOS Numbers diff --git a/bits/67_wsxml.js b/bits/67_wsxml.js index 61392ab..937a14d 100644 --- a/bits/67_wsxml.js +++ b/bits/67_wsxml.js @@ -296,6 +296,13 @@ function write_ws_xml(idx, opts, wb) { var ref = ws['!ref']; if(ref === undefined) ref = 'A1'; o[o.length] = (writextag('dimension', null, {'ref': ref})); + var sheetView = writextag('sheetView', null, { + showGridLines: opts.showGridLines == false ? '0' : '1', + tabSelected: opts.tabSelected === undefined ? '1' : opts.tabSelected, + workbookViewId: opts.workbookViewId === undefined ? '0' : opts.workbookViewId + }); + o[o.length] = writextag('sheetViews', sheetView); + if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); o[sidx = o.length] = ''; if(ws['!ref'] !== undefined) { diff --git a/package.json b/package.json index 46e6053..0947ced 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xlsx-style", - "version": "0.8.6", + "version": "0.8.7", "author": "sheetjs", "description": "Excel (XLSB/XLSX/XLSM/XLS/XML) and ODS spreadsheet parser and writer (extended to enable read/write of cell formats with xlsx files)", "keywords": [ "excel", "xls", "xlsx", "xlsb", "xlsm", "ods", "office", "spreadsheet" ], diff --git a/xlsx.js b/xlsx.js index 7effd08..054cb67 100644 --- a/xlsx.js +++ b/xlsx.js @@ -7821,6 +7821,13 @@ function write_ws_xml(idx, opts, wb) { var ref = ws['!ref']; if(ref === undefined) ref = 'A1'; o[o.length] = (writextag('dimension', null, {'ref': ref})); + var sheetView = writextag('sheetView', null, { + showGridLines: opts.showGridLines == false ? '0' : '1', + tabSelected: opts.tabSelected === undefined ? '1' : opts.tabSelected, + workbookViewId: opts.workbookViewId === undefined ? '0' : opts.workbookViewId + }); + o[o.length] = writextag('sheetViews', sheetView); + if(ws['!cols'] !== undefined && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); o[sidx = o.length] = ''; if(ws['!ref'] !== undefined) {