From f89115c9817b4cd4da91c7e3e9882b0eac4ae40d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 19 Feb 2017 11:06:32 +0000 Subject: Reset currentInstrText on "begin" fldChar --- lib/docx/body-reader.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js index 11aeec5..a19ecdb 100644 --- a/lib/docx/body-reader.js +++ b/lib/docx/body-reader.js @@ -159,7 +159,9 @@ function BodyReader(options) { "w:rPr": readRunProperties, "w:fldChar": function(element) { var type = element.attributes["w:fldCharType"]; - if (type === "end") { + if (type === "begin") { + currentInstrText = []; + } else if (type === "end") { complexFields.pop(); } else if (type === "separate") { var href = parseHyperlinkFieldCode(currentInstrText.join('')); @@ -168,7 +170,6 @@ function BodyReader(options) { } else { complexFields.push(null); } - currentInstrText = []; } return emptyResult(); }, -- cgit v1.2.3