This is a migrated thread and some comments may be shown as answers.

Error on IDocumentFormatProvider.Import for docx (Q1 2011)

3 Answers 129 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Joe Buckle
Top achievements
Rank 1
Joe Buckle asked on 18 Mar 2011, 01:28 AM
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.

 

3 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 18 Mar 2011, 06:28 PM
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
0
Joe Buckle
Top achievements
Rank 1
answered on 19 Mar 2011, 05:44 AM
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.
0
Boby
Telerik team
answered on 22 Mar 2011, 10:25 AM
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
Tags
RichTextBox
Asked by
Joe Buckle
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Joe Buckle
Top achievements
Rank 1
Boby
Telerik team
Share this question
or