Michael Bullock
Michael Bullock

Reputation: 11

Adding HTML content to a WPF printed page

I have a c# WPF app that emails a report which is a string containing HTML markup, using ms outlook interoperability I can specify the email message format should be rendered in HTML. So my email is rendered in HTML from a string containing HTML markup. This works fine, my email shows a rendered table from my HTML string.

BUT I also need to print this report using WPF but when I use the same string containing the HTML markup tags, the printout does not perform the rendering I just get an exact copy of the HTML text. So my print out never displays the table.

Can someone please tell me how I can use WPF to print a string containing HTML tags so that the content is rendered before it is printed out, like in my email example ??

Many thanks in advance

Upvotes: 1

Views: 1255

Answers (1)

brunnerh
brunnerh

Reputation: 185410

Rendering HTML is not a trivial issue.

You could use a WebBrowser to do that for you, or you could use a HTML to FlowDocument converter of sorts, the document then could be displayed in a FlowDocumentScrollViewer. There is no direct support for HTML in WPF.

Upvotes: 2

Related Questions