Skip to content

Read worksheet hidden state #728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ var worksheet = workbook.getWorksheet(1);

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

// make worksheet hidden
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]);
});
});
});
});
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy