0

I'm running into a problem that I can't seem to figure out. The scenario is:

  1. Download a bunch of text data as an HTML string
  2. Use an HTML-to-Xaml converter to parse the HTML string and create a List<Block> (Windows.UI.Xaml.Documents.Block).
  3. Display the collection of Blocks as a RichTextBlock control that's available in WinRT.

All of that works well. The problem is, I want to export this data as either a doc/docx or pdf file. Is there a way to export either the RichTextBlock directly or add these Blocks to a RichEditBox or even use the original HTML string to export to the file?

I looked at the Syncfusion Essential Studio, that offers the RichTextBoxAdv control, that's used as:

xmlns:rtba="using:Syncfusion.UI.Xaml.RichTextBoxAdv">

<Grid>
    <rtba:SfRichTextBoxAdv>

    </rtba:SfRichTextBoxAdv>
</Grid>

But so far as I can tell, there is no way to import Block data or use an HTML string. The latter used to exist in WPF but it's not there anymore. Any suggestions?

1 Answers1

0

Syncfusion SfRichTextBoxAdv control for WinRT supports importing and exporting HTML document, Word document, Rich Text Format document and Text document. With the help of this functionality, you can easily achieve your requirement by using Syncfusion SfRichTextBoxAdv control. Please do find the sample from below link.

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-2055612463

Kindly go through the online KB from following link, to know more information about binding HTML string to SfRichTextBoxAdv control.

https://www.syncfusion.com/kb/5415/how-to-bind-html-text-in-sfrichtextboxadv-control

Regards,

Arumuga Perumal S.

  • Hi. Thanks for the response. I can confirm that it's working with Syncfusion for Windows 10 UWP. However, the problem lies in the formatting. I've uploaded a screenshot here: http://imgur.com/yFsvOl9 On the left, you can see my method in which I'm using a long winded way of converting the HTML string to Block type data and showing them in RichTextBlock. On the right, I'm using the SFRichTextBoxAdv control with the method you mentioned. Same HTML string is used for both controls, but the SF control is not showing proper formatting. Is it a problem with the HTML string? Or is it not supported? – Khawar Nadeem Mar 29 '16 at 17:52
  • To add: The HTML is using the `` tag for italics, `` for bold and `
    ` for those horizontal partitions, and `

    ` for line breaks.

    – Khawar Nadeem Mar 29 '16 at 17:55