I am stuck in an issue,I have to show XML content in Richtextbox and do formatting as per element name , My problem is this that when i use RichtextBox selected property and font property than i lose all containing data of Richtextbox and, than how to format only that specific line or part of text .
foreach (XElement detail in doc.Descendants("title"))// put section ID
{
richTextBox1.SelectedText = detail.Value;
richTextBox1.SelectionFont = new Font("arial", 18);
detail.Value = Environment.NewLine + detail.Value + Environment.NewLine ;
VulpesPosted Jan 16, 2015, 8:58 AM
yashasvi KumarPosted Jan 16, 2015, 2:00 AM
I have tried it both of way by RTF and but text but problem is that, i am using XML file to read. and when i try to read specific element and formate it than it replace whole content of text box .
and if i try it using replace of string than my another data(which have same words) also formatted . as a part of XML
now what i did, get all text of XML in richtext box than try to format
and when i try it as above code it replace whole data and show only
Manish Kumar ChoudharyPosted Jan 16, 2015, 1:36 AM
Go through following links it will help you
http://www.dotnetperls.com/richtextbox
http://www.codeproject.com/Articles/15038/C-Formatting-Text-in-a-RichTextBox-by-Parsing-the
http://stackoverflow.com/questions/4077582/format-text-in-rich-text-box
yashasvi KumarPosted Jan 16, 2015, 1:29 AM
Thanks for reply
Sorry that I have forget to mention Winform application. actally i am doing work in winform C#.
Manish Kumar ChoudharyPosted Jan 15, 2015, 11:51 PM
Hi yashasvi Kumar,
Go through following links it will help you
http://www.aspsnippets.com/Articles/RichTextBox-Example-using-Free-TinyMCE-Editor-in-ASPNet.aspx
http://www.aspdotnet-suresh.com/2011/05/richtextbox-sample-in-aspnet-or-how-to.html