WPF RadRichTextbox Documents To ASP.NET RadEditor radflowdocument

2 posts, 0 answers
  1. Cristiano
    Cristiano avatar
    13 posts
    Member since:
    Feb 2012

    Posted 27 Jan 2015 Link to this post


    In my enterprise we have a WPF application, that runs a RadRichTextbox Editor. At the moment, we are migrating our system to web, refactoring all source to a MVC application.
    To achieve the same aspects and features that our RadRichTextbox had, we implemented the Telerik RadEditor in ASP.NET.

    The problem is that the old documments made on RadRichTextbox and saved as binary, aren't compatible with  the RadEditor in ASP.NET. 

    I tried to convert the binary documments with WPF DLLs docxProvider generating a radflowdocument, and exporting to the editor that same radflowdocument with the HTML provider.  The result is an inevitable error that HTML provider doesn't support the binary that converted by the docxProvider from WPF.

    I believe that the formats are completly differents and incompatibles, but we need some backward compatibility solution to display this old documents on our ASP.NET Telerik RadEditor.
    Here is what we tried to do:


    var binary = reportResp.Report.File; 
    Telerik.Windows.Documents.FormatProviders.OpenXml.Docx docxProvider = new using Telerik.Windows.Documents.FormatProviders.OpenXml.Docx;

    RadFlowDocument flowDocument = docxProvider.Import(binary); 
    HtmlFormatProvider htmlProvider = new HtmlFormatProvider(); <--- From Telerik.Windows.Documents.Flow.dll
    string result = htmlProvider.Export(flowDocument);  <----- error here -  flowDocument format not supported by htmlProvider

  2. Petya
    Petya avatar
    990 posts

    Posted 28 Jan 2015 Link to this post

    Hi Cristiano,

    Based on the provided information I think this is related to the DocxFormatProvider you are trying to use. I'll try to shed some clarity on the different assemblies and namespaces for the RadRichTextBox and RadWordsProcessing components.

    The Telerik.Windows.Documents.FormatProviders.OpenXml assembly and the provider in it are related to RadRichTextBox for WPF. This means that it can be used to convert from and to RadDocument. The same applies for the Telerik.Windows.Documents.FormatProviders.Html assembly and the HtmlFormatProvider that resides in it.

    RadFlowDocument, on the other hand, is the base class of WordsProcessing. This library also supports import and export from/to DOCX and HTML. However, the format providers that you need to use to produce a RadFlowDocument are in the Telerik.Windows.Documents.Flow.dll.

    Basically, to show the binary DOCX in RadEditor you can do one of the following:
    1. Take advantage of the WordsProcessing library shipped with the Telerik UI for ASP.AJAX suite and follow the approach demonstrated in the Import from DOCX and RTF article.
    2. Use the format provider assemblies related to RadRichTextBox for WPF and convert the document to HTML on the server.

    Also, as you mentioned you are creating an MVC application, please note that the controls in the Telerik UI for ASP.NET AJAX suite are not supported in an MVC setup

    I hope this is useful.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top