From f0afea0f30139f1023b86642dc6e24821d4926fa Mon Sep 17 00:00:00 2001 From: Mauricio Villalobos Date: Wed, 17 May 2017 16:23:47 -0600 Subject: [PATCH] Add missing Office Rels This makes the workbook properties appear correctly on the properties window inside MS Excel --- lib/stream/xlsx/workbook-writer.js | 4 +++- lib/xlsx/rel-type.js | 2 ++ lib/xlsx/xlsx.js | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/stream/xlsx/workbook-writer.js b/lib/stream/xlsx/workbook-writer.js index db920c8bc..c16c7443e 100644 --- a/lib/stream/xlsx/workbook-writer.js +++ b/lib/stream/xlsx/workbook-writer.js @@ -193,7 +193,9 @@ WorkbookWriter.prototype = { return new PromishLib.Promish(function(resolve) { var xform = new RelationshipsXform(); var xml = xform.toXml([ - {Id: 'rId1', Type: RelType.OfficeDocument, Target: 'xl/workbook.xml'} + {Id: 'rId1', Type: RelType.OfficeDocument, Target: 'xl/workbook.xml'}, + {Id: 'rId2', Type: RelType.CoreProperties, Target: 'docProps/core.xml'}, + {Id: 'rId3', Type: RelType.ExtenderProperties, Target: 'docProps/app.xml'} ]); self.zip.append(xml, {name: '/_rels/.rels'}); resolve(); diff --git a/lib/xlsx/rel-type.js b/lib/xlsx/rel-type.js index dd602db2e..5dedbac64 100644 --- a/lib/xlsx/rel-type.js +++ b/lib/xlsx/rel-type.js @@ -15,4 +15,6 @@ module.exports = { Theme: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', Hyperlink: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', Image: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', + CoreProperties: 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', + ExtenderProperties: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', }; diff --git a/lib/xlsx/xlsx.js b/lib/xlsx/xlsx.js index 51f9019b6..000edbeb9 100644 --- a/lib/xlsx/xlsx.js +++ b/lib/xlsx/xlsx.js @@ -472,7 +472,9 @@ XLSX.prototype = { return new PromishLib.Promish(function(resolve) { var xform = new RelationshipsXform(); var xml = xform.toXml([ - {Id: 'rId1', Type: XLSX.RelType.OfficeDocument, Target: 'xl/workbook.xml'} + {Id: 'rId1', Type: XLSX.RelType.OfficeDocument, Target: 'xl/workbook.xml'}, + {Id: 'rId2', Type: XLSX.RelType.CoreProperties, Target: 'docProps/core.xml'}, + {Id: 'rId3', Type: XLSX.RelType.ExtenderProperties, Target: 'docProps/app.xml'} ]); zip.append(xml, {name: '_rels/.rels'}); resolve();