Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

If Field

IfField is a Field element that compares two values and inserts the text appropriate to the result of the comparison.

Field Syntax

This is how the syntax of an If field looks like:

{ IF Expression1 Operator Expression2 TrueText FalseText }


In the table bellow are listed all the comparison operators.

Operator Description
= Equal to
<> Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

Expression1, Expression2

Values to compare.

TrueText, FalseText

Text that results when the comparison is true (TrueText) or false (FalseText). If FalseText isn't specified and the comparison is false, the IF field has no result. Each string containing multiple words must be enclosed in quotation marks.


Inserting an If field is easily achieved through the RadFlowDocumentEditor's InsertField() method. It accepts code as first argument and result as second argument.

Example 1: Insert If field

editor.InsertText("Wallet: "); 
editor.InsertInline(new Run(document)); 
Run wallet = editor.InsertText("99"); 
editor.InsertBookmark("Money", wallet, wallet); 
editor.InsertField("IF Money >= 100 \"Buy\" \"The minimum required amount is 100\"", "«T-shirt»"); 
The result of the above snippet is illustrated in Figure 1.

Figure 1: If field in a document

RadWordsProcessing Concepts Fields If Field 01

See Also

In this article