This is a migrated thread and some comments may be shown as answers.
How to use RadDocuments in MVC?
1 Answer 4 Views
This is a migrated thread and some comments may be shown as answers.
Kristian
Top achievements
Rank 1
Kristian asked on 02 Feb 2021, 09:23 AM

Hi,

We have a WPF solution with a blog, the blog messages are being saved into our database as RadDocuments.

Now we are building a MVC-solution which should also be able to show this blog.

 

 

The Problems are:

    1. how do I convert the RadDocument to HTML?

    2. how do I convert the RadDocument to RadFlowDocument so I can work with it in the Kendo.Editor?

 

Do you have examples on how to solve this?  RadDocument is loaded as a string from DB.

 

Regards Kristian

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 03 Feb 2021, 10:11 AM

Hello Kristian,

Directly to your questions.

1. You can use the HTML format provider which allows exporting RadDocuemnt to an HTML string: Using HtmlFormatProvider

2. To achieve this you must first export the RadDocuement to a format that is supported in the WordsProcessing library (for example docx) and that import it. Here is an example of this: 

RadDocument doc = radRichTextBox.Document;

var RTB_Provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
var flow_Provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();

var doc_bytes = RTB_Provider.Export(doc);
var flowDocuemnt = flow_Provider.Import(doc_bytes);

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Asked by
Kristian
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or