From 4ebe6280086fb0f98be71ffdb9b70544ddf599e3 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 21 May 2025 16:19:45 +0300 Subject: [PATCH] [de] Fix DataBinding --- word/Editor/StructuredDocumentTags/SdtPr.js | 18 ++---------------- word/Editor/custom-xml/data-binding.js | 6 ++++++ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/word/Editor/StructuredDocumentTags/SdtPr.js b/word/Editor/StructuredDocumentTags/SdtPr.js index d9c9eb3d58..9e0aa69bd3 100644 --- a/word/Editor/StructuredDocumentTags/SdtPr.js +++ b/word/Editor/StructuredDocumentTags/SdtPr.js @@ -58,7 +58,6 @@ function CSdtPr() this.Date = undefined; this.Equation = false; this.TextForm = undefined; - this.DataBinding = false; this.TextPr = new CTextPr(); @@ -293,13 +292,7 @@ CSdtPr.prototype.Write_ToBinary = function(Writer) this.ShdColor.toBinary(Writer); Flags |= (1 << 25); } - - if (this.DataBinding) - { - this.DataBinding.toBinary(Writer); - Flags |= (1 << 26); - } - + var EndPos = Writer.GetCurPosition(); Writer.Seek(StartPos); Writer.WriteLong(Flags); @@ -413,9 +406,6 @@ CSdtPr.prototype.Read_FromBinary = function(Reader) if (Flags & (1 << 25)) this.ShdColor = AscWord.CDocumentColorA.fromBinary(Reader); - - if (Flags & (1 << 26)) - this.DataBinding = AscWord.DataBinding.fromBinary(Reader); }; CSdtPr.prototype.IsBuiltInDocPart = function() { @@ -515,11 +505,7 @@ CContentControlPr.prototype.FillFromObject = function(oPr) this.BorderColor = AscWord.CDocumentColorA.fromObjectRgba(oPr.BorderColor); if (undefined !== oPr.DataBinding) - { - let oDataBinding = new AscWord.DataBinding(); - oDataBinding.fillFromObject(oPr.DataBinding); - this.DataBinding = oDataBinding; - } + this.DataBinding = AscWord.DataBinding.fromObject(oPr.DataBinding); }; CContentControlPr.prototype.FillFromContentControl = function(oContentControl) { diff --git a/word/Editor/custom-xml/data-binding.js b/word/Editor/custom-xml/data-binding.js index 03cf7e6ec1..582644e134 100644 --- a/word/Editor/custom-xml/data-binding.js +++ b/word/Editor/custom-xml/data-binding.js @@ -88,6 +88,12 @@ data.Read_FromBinary(reader); return data; }; + DataBinding.fromObject = function(obj) + { + let data = new DataBinding(); + data.fillFromObject(obj); + return data; + }; DataBinding.prototype.Write_ToBinary = function(writer) { let startPos = writer.GetCurPosition();