From a1861f877fe4a1664004cb7114ee4695e7aa8c1b Mon Sep 17 00:00:00 2001 From: Tomas Kirda Date: Tue, 4 Oct 2016 14:46:23 -0500 Subject: [PATCH] Do not escape xml characters when using shared strings --- lib/utils/shared-strings.js | 3 --- spec/integration/workbook-xlsx-writer.spec.js | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/utils/shared-strings.js b/lib/utils/shared-strings.js index e3cd1a28c..d460b2443 100644 --- a/lib/utils/shared-strings.js +++ b/lib/utils/shared-strings.js @@ -22,8 +22,6 @@ */ "use strict"; -var utils = require("./utils"); - var SharedStrings = module.exports = function() { this._values = []; this._totalRefs = 0; @@ -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; diff --git a/spec/integration/workbook-xlsx-writer.spec.js b/spec/integration/workbook-xlsx-writer.spec.js index 0816d4ced..aa5358bfb 100644 --- a/spec/integration/workbook-xlsx-writer.spec.js +++ b/spec/integration/workbook-xlsx-writer.spec.js @@ -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']); 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