Question How to make specific words bold, on iTextSharp

Revolution

New member
Joined
Feb 9, 2016
Messages
1
Programming Experience
Beginner
Hello ! I am writing a simple program on CSharp. What it does, is that you write a text(in a richTextBox), and it saves it's content on a .pdf in a specific path. Now, i want the user to target a specific word/phrase, and by clicking a button, the specific word/phrase will go bold. Is this possible ?? And if yes, how ??
 
So you want the word emboldened in the RichTextBox then, right? I have ignored this thread for days because I've never used iTextSharp but now that I've read it it seems that that was a red herring. If you want to embolden text in a RichTextbox then you set the SelectionStart and SelectionLength properties to select that text and then do this:
RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, RichTextBox1.SelectionFont.Style Or FontStyle.Bold)
To remove the bold style, do this:
RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, RichTextBox1.SelectionFont.Style And Not FontStyle.Bold)
 
Back
Top Bottom