Skip to content

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

@Sergio1C

Description

@Sergio1C

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions