From 8b1add6659a66d2e6e72e1d9fe3100446dd495ad Mon Sep 17 00:00:00 2001
From: Pieter Sheth-Voss <pieter@protobi.com>
Date: Fri, 4 Dec 2015 09:53:43 -0500
Subject: [PATCH] Add showGridLines as option

---
 README.md        | 2 ++
 bits/67_wsxml.js | 7 +++++++
 xlsx.js          | 7 +++++++
 3 files changed, 16 insertions(+)

diff --git a/README.md b/README.md
index e5c862e..8c5ada2 100644
--- a/README.md
+++ b/README.md
@@ -478,6 +478,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] = '<sheetData/>';
 	if(ws['!ref'] !== undefined) {
diff --git a/xlsx.js b/xlsx.js
index b44fe15..67b04e9 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] = '<sheetData/>';
 	if(ws['!ref'] !== undefined) {