DocxFormatProvider no longer appears to be an IDocumentFormatProvider

4 posts, 1 answers
  1. Jason
    Jason avatar
    21 posts
    Member since:
    Mar 2012

    Posted 18 Aug 2014 Link to this post

    Good morning,
    My company is looking at using the RadRichTextBox control for rendered, editing, and exporting Docx documents. I am attempting to write a small test app as a proof-of-concept but I've hit a problem I can't get around. In all of the demos/tutorials I am seeing online they are creating a DoxFormatProvider and using it to create a document like the following:

    using( Stream readStream = dialog.OpenFile() )
       IDocumentFormatProvider provider = new DocxFormatProvider();
       RadDocument = provider.Import( readStream );

    Unfortunately what I am seeing is that DocxFormatProvider will not cast to an IDocumentFormatProvider. DocxFormatProvider appears to be a BinaryFormatProviderBase<RadFlowDocument> found in the Telerik.Windows.Documents.Flow assembly. The DocxFormatProvider returns a RadFlowDocument rather than a RadDocument which I have been unable to find a way to get a RadFlowDocument to work in the RadRichTexTextBox control.

    It appears like all other providers have their own DLL following the pattern Telerik.Windows.Documents.FormatProviders.XXX.dll where XXX is the provider type but I do not see a Docx DLL. The assemblies I am working with are 2014.2.729.45. Any guidance would be greatly appreciated. Thanks!
  2. Answer
    Petya avatar
    990 posts

    Posted 19 Aug 2014 Link to this post

    Hello Jason,

    Indeed, the Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider class is used to import/export RadFlowDocument instances. The class is related to the functionality of the RadWordsProcessing library and would not work with RadRichTextBox.

    In order to create a RadDocument, you need to use the format provider located in the Telerik.Windows.Documents.FormatProviders.OpenXml.dll in the Telerik.Windows.Documents.FormatProviders.OpenXml.Docx namespace. Please note that a reference to the Telerik.Windows.Zip.dll is required as well to ensure the provider works properly.

    I hope this helps.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. Michael
    Michael avatar
    2 posts
    Member since:
    Nov 2015

    Posted 17 Feb 2016 Link to this post

    Even though this is the WPF forum, I have encountered the same problem in a WinForms application.  The error I am getting is that "Value of type 'RadDocument' cannot be converted to 'RadDocument'.  I have attached an image with the code and error.

    I tried using the code directly from this page ("") and simplified it to try to eliminate the error.  No luck.  Any suggestions?

  4. Michael
    Michael avatar
    2 posts
    Member since:
    Nov 2015

    Posted 17 Feb 2016 in reply to Michael Link to this post

    UPDATE:  The issue was apparently caused by the fact that my sample application was using both a RadFlowDocument and RadDocument and VS intellisense was grabbing the wrong library.  It was using Telerik.Windows.Documents.... instead of Telerik.WinForms.Documents....  When I directly referenced the namespaces everything worked.  Hope this helps someone else!
Back to Top