Tag Archives: RTF

Convert RTF and TXT files into DOCX files in C#

First add a reference to Microsoft.Office.Interop.Word. To make using the library easier, add this using statement: using Word = Microsoft.Office.Interop.Word; When you enter the input and output file names and click Convert, the program uses the following code to open … Continue reading

Posted in files, interoperability, Office, Word | Tagged , , , , , , , , , , , , , | Leave a comment

Use WPF code to display subscripts and superscripts in C#

In the post Display subscripts and superscripts in a WPF TextBlock in C# I mentioned that you could make subscripts and superscripts in WPF code but it was easier in XAML code. Juan Manuel Montes asked for an example, so … Continue reading

Posted in fonts, formatting, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Display subscripts and superscripts in a WPF TextBlock in C#

The following examples show how to display subscripts and superscripts in a RichTextBox in a Windows Forms program. Easily display subscripts and superscripts in a RichTextBox in C# Display subscripts and superscripts in a RichTextBox in C# In a WPF … Continue reading

Posted in fonts, formatting, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Easily display subscripts and superscripts in a RichTextBox in C#

The example Display subscripts and superscripts in a RichTextBox in C# requires you to make arrays holding the positions of the characters that should be subscripts and superscripts. That’s not a big deal but it does require you to count … Continue reading

Posted in fonts, formatting | Tagged , , , , , , , , , , , , , , , | 3 Comments

Set RichTextBox tab stops in C#

You can set different RichTextBox tab stops for different parts of a RichTextBox control’s text. This example uses the following code to set tabs for the whole control and then adds some text to it that includes tabs. // Set … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , , , | Leave a comment

Format text in a RichTextBox in C#

To format text in a RichTextBox, use the control’s Select method to select the text. Then use the “Selection” properties (SelectionAlignment, SelectionBackColor, SelectionFont, etc.) to set the properties for the selected text. This example uses the following code to format … Continue reading

Posted in controls | Tagged , , , , , , , , , , , | 2 Comments

Copy and paste data in multiple formats to the clipboard in C#

This example shows how to copy and paste data in multiple formats to the clipboard. It saves data in Rich Text (RTF), text, and HTML formats. When you paste the data, it separately displays each of those formats that are … Continue reading

Posted in clipboard | Tagged , , , , , , , , , , , | 4 Comments

Make a notepad application that uses encryption in C#

The example Make a password manager in C# shows how you can use encryption to manage passwords safely. This example uses a much simpler approach, although it provides fewer features. This program lets you save information in a RichTextBox into … Continue reading

Posted in algorithms, cryptography, mathematics, tools | Tagged , , , , , , , , , , , , , , | Leave a comment