diff --git a/cell/model/Serialize.js b/cell/model/Serialize.js index 157a82f450..deb2dababc 100644 --- a/cell/model/Serialize.js +++ b/cell/model/Serialize.js @@ -307,7 +307,11 @@ RdRichValueTypes: 33, // Euro-Office extension: kept far above the ids above so that a record added later in the // same sequence cannot take it - SourceFileType: 100 + SourceFileType: 100, + // Euro-Office extension, next to SourceFileType: sheets the editor cannot show (Excel 4.0 + // macro sheets). Opaque here; core writes and parses the payload. The next Euro-Office + // record takes 102, here and in core (OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h). + PreservedSheets: 101 }; /** @enum */ var c_oSerWorkbookPrTypes = @@ -3840,6 +3844,11 @@ this.bs.WriteItem(c_oSerWorkbookTypes.ExternalReferences, function() {oThis.WriteExternalReferences();}); } if (!this.isCopyPaste) { + if (this.wb.preservedSheets) { + this.bs.WriteItem(c_oSerWorkbookTypes.PreservedSheets, function() { + oThis.memory.WriteBuffer(oThis.wb.preservedSheets, 0, oThis.wb.preservedSheets.length); + }); + } if (this.wb.oApi.vbaProject) { this.bs.WriteItem(c_oSerWorkbookTypes.VbaProject, function() { var old = new AscCommon.CMemory(true); @@ -9641,6 +9650,10 @@ this.oWorkbook.setOleSize(new AscCommonExcel.OleSizeSelectionRange(null, parsedRange)); } } + else if (c_oSerWorkbookTypes.PreservedSheets === type) + { + this.InitOpenManager.oReadResult.preservedSheets = this.stream.GetBufferUint8(length); + } else if (c_oSerWorkbookTypes.VbaProject === type) { let _end_rec = this.stream.cur + length; @@ -14044,6 +14057,7 @@ if (this.InitOpenManager.oReadResult.vbaProject) { wb.oApi.vbaProject = this.InitOpenManager.oReadResult.vbaProject; } + wb.preservedSheets = this.InitOpenManager.oReadResult.preservedSheets; wb.checkCorrectTables(); }; this.PostLoadPrepareDefNames = function(wb) @@ -14855,6 +14869,7 @@ pivotCacheDefinitions: {}, vbaMacros: null, vbaProject: null, + preservedSheets: null, macros: null, slicerCaches: {}, tableIds: {}, @@ -14904,6 +14919,7 @@ if (this.oReadResult.vbaProject) { wb.oApi.vbaProject = this.oReadResult.vbaProject; } + wb.preservedSheets = this.oReadResult.preservedSheets; wb.checkCorrectTables(); }; diff --git a/cell/model/Workbook.js b/cell/model/Workbook.js index 0f61309c89..97e265088b 100644 --- a/cell/model/Workbook.js +++ b/cell/model/Workbook.js @@ -3278,6 +3278,9 @@ // File type (Asc.c_oAscFileType) of the document the workbook was converted from, when the // converter recorded it; null otherwise. this.sourceFileType = null; + // Sheets the editor cannot show (Excel 4.0 macro sheets), as an opaque Uint8Array + // that is written back unchanged on save. + this.preservedSheets = null; AscFormat.ExecuteNoHistory(function () { this.CustomProperties = new AscCommon.CCustomProperties();