UNIT6-open / TemplateEngine.Docx

Smart docx template engine for .NET
Other
408 stars 136 forks source link

Add support for conditional statements #23

Open amd-9 opened 7 years ago

amd-9 commented 7 years ago

It's would be nice to have functionality that allows to display templates based on condition. For example if property of FieldContent equals true display one block of templates and another one in case of false.

abatar1 commented 7 years ago

Hi! Now every content contains method Hide(). You can write something like this: var content = new Content(new FieldContent("Test", "test").Hide(/*here comes your predicate*/));

alex-novikov-1990 commented 7 years ago

The closest behavior to desired I get vianew RepeatContent("hider") and new RepeatContent("hider").AddItem(....).