Error on IDocumentFormatProvider.Import for docx (Q1 2011)

4 posts, 0 answers
  1. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 17 Mar 2011 Link to this post

    Good day!

    I've upgraded to the latest version to test the application I'm building, but there seems to be breaking changes. Before I was able to call this line of code without problem:

     

     

    IDocumentFormatProvider docxProvider = DocumentFormatProvidersManager.GetProviderByExtension(".docx");

     

     

     

     

    RadDocument document = docxProvider.Import(e.Result);

    But now, I'm getting an 'Object reference not set to an instance of an object' using the new build. Why is this so?

    Thanks.

     

  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 18 Mar 2011 Link to this post

    Hi Joe Buckle,

    Could you please verify that you have a reference to Telerik.Windows.Documents.FormatProviders.OpenXml in your Silverlight project? Perhaps you have missed it when changing the DLLs to the new version of the controls. I tested your code with the latest version and was able to reproduce the behavior only when the reference was omitted.
    If that does not help you solve the issue, do not hesitate to get back to us.

    Greetings,
    Iva
    the Telerik team
  3. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 19 Mar 2011 Link to this post

    Thank you very much for your response.

    Yes, I've added the same assemblies, but I'm still getting an error with the new version. I'm using the same code, and it works ok with the previous version.
  4. Boby
    Admin
    Boby avatar
    763 posts

    Posted 22 Mar 2011 Link to this post

    Hello Joe Buckle,

    Is the docxProvider null or exception is thrown from the Import method? In the first case MEF cannot find Telerik.Windows.Documents.FormatProviders.OpenXml assembly. You could test if the code works with directly instantiating DocxFormatProvider and use it:

    RadDocument document = new DocxFormatProvider().Import(e.Result);
    which is pretty much the same in your case.
    Other reason causing this could be assembly caching - the assembly is still cached on the server when MEF tries to load them.
    If the exception comes from within Import method the issue should be document specific and if this is the case you could open a support ticket and send us a sample document that causes the exception.

    All the best,
    Boby
    the Telerik team
Back to Top