I am generating an HTML string in a WPF application, and I am outputting it to a multiline textbox. Right now the output is wrapping, but is showing up similar to a paragraph. I would like it to be shown as formatted HTML. It wouldn't even have to be very nice formatting, but at least not show a paragraph of HTML.
How can I accomplish this?
If your HTML is well-formed XML, then the XElement.ToString()
method will format with indents and newlines:
try
{
formattedOutput = System.Xml.Linq.XElement.Parse(myHtmlString).ToString();
}
catch
{
// isn't well-formed xml
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With