Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
3 changes: 0 additions & 3 deletions lib/utils/shared-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
"use strict";

var utils = require("./utils");

var SharedStrings = module.exports = function() {
this._values = [];
this._totalRefs = 0;
Expand All @@ -46,7 +44,6 @@ SharedStrings.prototype = {
},

add: function(value) {
value = utils.xmlEncode(value);
var index = this._hash[value];
if (index === undefined) {
index = this._hash[value] = this._values.length;
Expand Down
18 changes: 18 additions & 0 deletions spec/integration/workbook-xlsx-writer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,24 @@ describe('WorkbookWriter', function() {
});
});

it('does not escape special xml characters', function () {
var wb = new Excel.stream.xlsx.WorkbookWriter({filename: TEST_FILE_NAME, useSharedStrings: true});
var ws = wb.addWorksheet('blort');
var xmlCharacters = 'xml characters: & < > "';

ws.getCell('A1').value = xmlCharacters;

return wb.commit()
.then(function() {
var wb2 = new Excel.Workbook();
return wb2.xlsx.readFile(TEST_FILE_NAME);
})
.then(function(wb2) {
var ws2 = wb2.getWorksheet('blort');
expect(ws2.getCell('A1').value).to.equal(xmlCharacters);
});
});

it('serializes and deserializes dataValidations', function() {
var options = {filename: TEST_FILE_NAME};
var wb = testUtils.createTestBook(new Excel.stream.xlsx.WorkbookWriter(options),'xlsx', ['dataValidations']);
Expand Down