Hi All,
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 ;
}
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
<chapter>
<section level="1" number-type="manual" num="2">
<title>Modalités d’application de l’absence</title>
<section num="1." number-type="manual" level="sect2">
<title>ABSENCE PENDANT LE «DELAI DE PREAVIS»</title>
<para align="left">Le travailleur peut s’absenter pendant le «délai de préavis».</para>
<para align="left">Seul le contrat de travail à durée indéterminée peut être rompu moyennant préavis. La réglementation ne s’applique donc pas aux contrats de travail à durée déterminée ou pour un travail nettement défini. ABSENCE PENDANT LE «DELAI DE PREAVIS»..</para>
</section
</section>
</chapter>
now what i did, get all text of XML in richtext box than try to format <title> element data,
and when i try it as above code it replace whole data and show only <title>