From aeb12c1ab8e9e15e2b0469d23586ff03c6f114f5 Mon Sep 17 00:00:00 2001 From: Brett Prucha Date: Mon, 25 Mar 2024 11:35:51 -0400 Subject: [PATCH] Add support to conditional check for undefined tags --- samples/docx/TestIfStatement.docx | Bin 13706 -> 14172 bytes src/MiniWord/MiniWord.Implment.cs | 5 ++++- tests/MiniWordTests/MiniWordTests.cs | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/samples/docx/TestIfStatement.docx b/samples/docx/TestIfStatement.docx index 23fab8a9ff405c2275a7c20935d8602c2faf0ec3..9ed3fe9047a2e64639befb5af434f450afe63d80 100644 GIT binary patch delta 5620 zcmZ9QWmwc*x5fvMZWu{vkZ|ZBq`Rb%mKah51|%i_)X+U3AxKG=fV8ND;1B}R45@T? z$MHSqyzg_abAQ^`UTc5aYu{`AcC7Op{9`8$K@%R;=PVo$Xn+-oflmXNS-8DZ0|!|- z-D4doPH1R_(q?upNVHq$$BwIvI$VD)6ll`Bq|p3rS9Eip+i4x%`9_n%N$izNW|AlA z`GV*E^yc~^({HslPCxPzRA6DS{$mRD8z>%fBJk*z|GX}z;=%!gnGMWPa=9J+ z&{;&7qasUI!xqS?D1@exBvpo_e0_ODoP9*O>rb*ZHHs!`T)h-%dAH=GLLu6!c|2XT zBWi`J%eenMz(?c0HhQ2+gE&cn@svd#cCD=Askls$utavw;F%>HWG~;nQ)L zxQm+))(&c#x9ZsSNmd(#2#ckouo4K&_J@=Mo9E%ih~ks%9AxyRpjNDR=5B?e6jg#& zjdSuf3+`N>UIze2mWSy}8qMyw(wv2`o>WeMAANf%P*{PdgjC$|iPn9IuFC3xgr7&M zww5fvF#LEi4$8+031ppyydo;S;+~*y92|uA&mQoGnYkmr8n?L>2*U^!2D;?QvXr zqjhj`BWb|1J8J2<@(3^S`VGQTMjA0NEcEqv?W*-cgs;m`lYDEqu+*?K1>fF^UbKaz_P*?=S^f*|pFr)Rzeknh)vnAd%`5|BQ zVZ4jU#~|*+S$&g8mrz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q4ac(#*oty-(TAfUY^E91>Za)canhy(##vHFEl_*?~@qz+U zDKsFem^~tWk+w#flzCTsYt_49g$4A`2ZE?TEd=D%5cFQ7K{7;vA;vCf%FnUvs)7Wn zyHp8(ryy!4w;&zhCfCKr8J1Y9xYFIi)$g#9LfheMtr4{>c+W|KR_uvU%YG!pxX8&;Q!}KWQtqf&c&j diff --git a/src/MiniWord/MiniWord.Implment.cs b/src/MiniWord/MiniWord.Implment.cs index ffe2a6f..7009950 100644 --- a/src/MiniWord/MiniWord.Implment.cs +++ b/src/MiniWord/MiniWord.Implment.cs @@ -526,7 +526,7 @@ private static void ReplaceStatements(OpenXmlElement xmlElement, Dictionary