MiniWord icon indicating copy to clipboard operation
MiniWord copied to clipboard

if statement with boolean (at least not for multi Paragraph) is not working

Open Sergio1C opened this issue 9 months ago • 0 comments

From C# code:

var disolved = true;
var templateContext = new Dictionary<string, object?>()
 {
       //...
        { "Disolved", disolved },
      };

      using var ms = new MemoryStream();
      MiniSoftware.MiniWord.SaveAsByTemplate(ms, templateContent, templateContext);

docx template:

{{if({{Disolved}},==,true)ifSome_text_if_tue. endif}} {{if({{Disolved}},==,false)ifSome_text_if_false. endif}}

Actual behavior: If variable dissolved = true (or false, it does not matter), then neither the first text nor the second is displayed.

Expected behavior: If variable dissolved = true or false then corresponded text should be displayed.

Assembly MiniWord, Version=0.9.2.0

PS: I noticed as a workaround it can be replaced with integer data type. Is it by design? If yes it should be documented

Sergio1C avatar May 23 '25 08:05 Sergio1C