I have XAML data from a Rich text editor. The information I have in XAML is about HTML tags and their associated attributes. Like paragraph, its text, style, etc. I want to convert it into HTML. A part of XAML:
How do I convert this into HTML?
Talk1:
The same way we can convert apples into oranges. It doesn't make sense.
Talk2:
True. But the information I have in XAML is about HTML tags and their associated attributes. Like paragraph, its text, style, etc. Please help.
Solutions1
So what you have there is a RadDocument.
You can convert this to HTML easily using the Telerik tools:
public string ConvertToHtml(RadDocument doc)
{
return new HtmlFormatProvider().Export(doc);
}
Alternatively, if your xaml exists as a string you can do this:
public string ConvertXamlToHtml(string xamlString)
{
return new HtmlFormatProvider().Export(new XamlFormatProvider().Import(xamlString));
}
Talk1:
Thanks, I used this approach and it worked.