Step 5: Text Formatting

This sample shows how to use the Selection class to format a text and to insert it into the document. It shows just 4 simple formattings: bold, italic, underline and strikeout.

Important code snippet:

1: TXTextControl.Selection formattedSelection = new TXTextControl.Selection();
2: formattedSelection.Text = TextBox1.Text;
3: formattedSelection.Bold = true;
4: serverTextControl1.Selection = formattedSelection;

Sample Text:

Text Formatting: