forked from exceljs/exceljs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exceljs#951: Force formula re-calculation on file open from Excel
- Loading branch information
Szymon Lubieniecki
authored and
Szymon Lubieniecki
committed
Oct 3, 2019
1 parent
fb0e9ea
commit 9f949d3
Showing
13 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const BaseXform = require('../base-xform'); | ||
|
||
class WorkbookCalcPropertiesXform extends BaseXform { | ||
render(xmlStream, model) { | ||
xmlStream.leafNode('calcPr', { | ||
calcId: 171027, | ||
fullCalcOnLoad: model.fullCalcOnLoad ? 1 : undefined, | ||
}); | ||
} | ||
|
||
parseOpen(node) { | ||
if (node.name === 'calcPr') { | ||
this.model = {}; | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
parseText() {} | ||
|
||
parseClose() { | ||
return false; | ||
} | ||
} | ||
|
||
module.exports = WorkbookCalcPropertiesXform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,8 @@ | |
], | ||
"properties": { | ||
"date1904": true | ||
}, | ||
"calcProperties": { | ||
"fullCalcOnLoad": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ | |
], | ||
"properties": { | ||
"date1904": true | ||
} | ||
}, | ||
"calcProperties": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
spec/unit/xlsx/xform/book/workbook-calc-properties-xform.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const testXformHelper = require('./../test-xform-helper'); | ||
|
||
const WorkbookCalcPropertiesXform = verquire('xlsx/xform/book/workbook-calc-properties-xform'); | ||
|
||
const expectations = [ | ||
{ | ||
title: 'default', | ||
create() { | ||
return new WorkbookCalcPropertiesXform(); | ||
}, | ||
preparedModel: {}, | ||
xml: | ||
'<calcPr calcId="171027"></calcPr>', | ||
parsedModel: {}, | ||
tests: ['render', 'renderIn'], | ||
}, | ||
{ | ||
title: 'fullCalcOnLoad', | ||
create() { | ||
return new WorkbookCalcPropertiesXform(); | ||
}, | ||
preparedModel: {fullCalcOnLoad: true}, | ||
xml: | ||
'<calcPr calcId="171027" fullCalcOnLoad="1"></calcPr>', | ||
parsedModel: {}, | ||
tests: ['render', 'renderIn', 'parse'], | ||
}, | ||
]; | ||
|
||
describe('WorkbookCalcPropertiesXform', () => { | ||
testXformHelper(expectations); | ||
}); |