Embed Font into RichTextBox

Posted by Gpt under Windows Forms on 9/26/2015 | Points: 10 | Views : 2237 | Status : [Member] | Replies : 1
Hi, I am trying to embed 'Telugu' font into richtextbox to display text in 'Telugu' pulling from a word document, it embeds font but I still see the text as junk (few words are showing in telugu, can any please help me resolve this issue. Here is my code

Microsoft.Office.Interop.Word.Application wrd = new Microsoft.Office.Interop.Word.Application();
object miss = System.Reflection.Missing.Value;
object path = @"C:\Sample\XYZ.docx";
object readOnly = true;
Microsoft.Office.Interop.Word.Document docs=wrd.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss,ref miss, ref miss, ref miss, ref miss);
string totaltext = "";
for (int i = 0; i < docs.Paragraphs.Count; i++)
totaltext+=" \r\n "+ docs.Paragraphs[i+1].Range.Text.ToString();
PrivateFontCollection pv = new System.Drawing.Text.PrivateFontCollection();
rTxtDoc.Font = new Font(pv.Families[0], 10, FontStyle.Regular);
rTxtDoc.Text = totaltext;

Thanks in advance



Posted by: Rajnilari2015 on: 9/26/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

First download Tamil font and install your pc.Then change the controls font name corresponding to the tamil font as under

Drag andDrop RichTextBox on to your Windows Form,then Press F4 For Property Window.
Perform the below settings Font -> Tamil Bible, 8.25pt, style=Bold

Hope this helps

Thanks & Regards,
RNA Team

Gpt, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response