0

I am creating a help file that uses xml as a source.

The xml file is in the project resource. Which will be read by using XmlNode.InnerText.

private void displayHelpText(string strTitle)
    {
        XmlNode xmlNode;
        string strHelp;

        xmlNode = XmlDoc.SelectSingleNode("//*[title='" + strTitle + "']");
        strHelp = xmlNode.InnerText;
        //strHelp = xmlNode.InnerXml;
        richTextBox1.Text = strHelp;
    }

The text I want to bolden in the xml file.

<Introduction>
<title>Account Password</title>
The default password is <b>12345678</b>
</Introduction>

The result is that the password is not bolden in the richtextbox. Is there any way to preserve styling?

  • XML and RTF formats are very different. For example, how do you want `` to be displayed? In XML that is a root node, containing other text and nodes, do you want it as a heading? Or just regular text? Or showing the `<>` symbols? Or not show it at all? Also note that `` has no significance in XML, but it may in XHTML which is what this appears to be. – Charlieface Aug 14 '22 at 01:47
  • Does this answer your question? [How do I convert HTML to RTF (Rich Text) in .NET without paying for a component?](https://stackoverflow.com/questions/150208/how-do-i-convert-html-to-rtf-rich-text-in-net-without-paying-for-a-component) – Charlieface Aug 14 '22 at 01:50

0 Answers0