Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,13 @@ var worksheet = workbook.getWorksheet(1);

```javascript
// make worksheet visible
worksheet.state = 'show';
worksheet.state = 'visible';

// make worksheet hidden
worksheet.state = 'hidden';

// make worksheet hidden from 'hide/unhide' dialog
worksheet.state = 'veryHidden';
```

## Worksheet Properties
Expand Down
2 changes: 2 additions & 0 deletions lib/doc/workbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ Workbook.prototype = {
var id = worksheetModel.id;
var name = worksheetModel.name;
var orderNo = value.sheets.findIndex(ws => ws.id === id);
var state = worksheetModel.state;
var worksheet = this._worksheets[id] = new Worksheet({
id: id,
name: name,
orderNo,
state,
workbook: this
});

Expand Down
2 changes: 1 addition & 1 deletion lib/doc/worksheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var Worksheet = module.exports = function(options) {
this.name = options.name || 'Sheet' + this.id;

// add a state
this.state = options.state || 'show';
this.state = options.state || 'visible';

// rows allows access organised by row. Sparse array of arrays indexed by row-1, col
// Note: _rows is zero based. Must subtract 1 to go from cell.row to index
Expand Down
2 changes: 1 addition & 1 deletion lib/stream/xlsx/worksheet-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var WorksheetWriter = module.exports = function(options) {
this.name = options.name || 'Sheet' + this.id;

// add a state
this.state = options.state || 'show';
this.state = options.state || 'visible';

// rows are stored here while they need to be worked on.
// when they are committed, they will be deleted.
Expand Down
Binary file added spec/integration/data/test-pr-728.xlsx
Binary file not shown.
22 changes: 22 additions & 0 deletions spec/integration/pr/test-pr-728.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

var chai = require('chai');

var verquire = require('../../utils/verquire');

var Excel = verquire('excel');

var expect = chai.expect;

describe('github issues', function() {
it('pull request 728 - Read worksheet hidden state', function() {
var wb = new Excel.Workbook();
return wb.xlsx.readFile('./spec/integration/data/test-pr-728.xlsx')
.then(function() {
var expected = {1: 'visible', 2: 'hidden', 3: 'visible'};
wb.eachSheet(function(ws, sheetId) {
expect(ws.state).to.equal(expected[sheetId]);
});
});
});
});