Exception when constructing a Document

Hello,

I am getting the following exception on a clients machine when I try to construct a Document class with a word document. I am using Aspose.Words 4.2.5.0.

The word document appears to be ok.

2007-09-28 17:07:35,217 [2696] ERROR CMS [] - Exception: System.InvalidCastException
Message: Unable to cast object of type ‘x1a62aaf14e3c5909.xf6779bbc50998d69’ to type ‘x1a62aaf14e3c5909.xd959c7c7ca733332’.
Source: Aspose.Words
at x1a62aaf14e3c5909.xfbb3f4be330f4086.DoRead(BinaryReader reader)
at x1a62aaf14e3c5909.xddf6304144fd3863.x06b0e25aa6ad68a9(xebb8e4f90b5c1d33 x6b0ad9f73c48ad53, BinaryReader xe134235b3526fa75)
at x1a62aaf14e3c5909.x622ccf73c1aa9e89.x06b0e25aa6ad68a9(BinaryReader xe134235b3526fa75, Int32 x961016a387451f05)
at x1a62aaf14e3c5909.x821732b125012c9e.xa5b547b6ce00aa54(x7e738ecc9d58b06d x26bd0e776a61cb6b, BinaryReader x2876c9437120b4af, Int32 x9e4be1b404ab074b)
at x16f9a31f749b8bb1.x32eac27632acc346.x9ace1ae461aa5e98(x409512556c3f2a9a x2ced84c6b9a55dad, xeedad81aaed42a76 x789564759d365819, Int32 x9e4be1b404ab074b)
at x16f9a31f749b8bb1.x32eac27632acc346.xae86397ff5ef8e2c(xeedad81aaed42a76 x789564759d365819, Int32 x6211ee450938c2c4)
at x16f9a31f749b8bb1.x32eac27632acc346.x3fcc6938e0108016(Char x12f11d52c2c4d003, Int32 x1e5b3c79ded5dbc8, xeedad81aaed42a76 x789564759d365819, xa52f2632c0ffdfaf xe08a26cc2b49f3aa)
at x16f9a31f749b8bb1.x32eac27632acc346.xdf2cafeb128b2de9(xeedad81aaed42a76 x789564759d365819, xa52f2632c0ffdfaf xe08a26cc2b49f3aa, x98d75821045fe9bd xbb8131fb9e06f47f, Int32 xd4f974c06ffa392b, Int32 x961016a387451f05)
at x16f9a31f749b8bb1.x32eac27632acc346.xf59aaff7aa68ace1(x1a78664fa10a3755 x062aae8c9613eeaa)
at x16f9a31f749b8bb1.x32eac27632acc346.xb61b92627231b7a8(Int32 x03e8ba449439270f)
at x16f9a31f749b8bb1.x32eac27632acc346.xbac2e778f3c6bad1(x98d75821045fe9bd xbb8131fb9e06f47f)
at x16f9a31f749b8bb1.x32eac27632acc346.x1f490eac106aee12(Int32 x828697433249d659, Int32 x961016a387451f05)
at x16f9a31f749b8bb1.x32eac27632acc346.x7319f5f5433dca3a(HeaderFooterType xa685fef1a31f5d4d)
at x16f9a31f749b8bb1.x32eac27632acc346.x709a32d98832a838()
at x16f9a31f749b8bb1.x32eac27632acc346.x1f490eac106aee12()
at x16f9a31f749b8bb1.x0f8a9a895bdf560e.x06b0e25aa6ad68a9()
at Aspose.Words.Document.x5d95f5f98c940295(Stream xcf18e5243f8d5fd3, LoadFormat xdef7b99b7fc67519, String xe8e4b5871d71a79a)
at Aspose.Words.Document…ctor(String fileName, LoadFormat loadFormat, String password)
at Aspose.Words.Document…ctor(String fileName)
at CMS.Ui.Brief.Util.BriefCreator.AddDocument(String documentLocation, DocumentInfo docInfo, DocumentBuilder briefBuilder)

Any ideas would be appreciated.

Ta,
JP

Hi
Thanks for your request. Please provide me the code to reproduce this problem. Also try to use the latest version of Aspose.Words. You can get the latest version here:
https://releases.aspose.com/words/net
Best regards.

Hi I am Getting the error
Unable to cast COM object of type ‘Microsoft.Office.Interop.Word.DocumentClass’ to class type ‘Aspose.Words.Document’. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

Word.Document document = (Word.Document)docEdit.ActiveDocument;
Aspose.Words.Document doc = (Aspose.Words.Document)document;

where docEditor is the ocx control
Can you tell me how do i convert from word ocx control to Aspose.Words.Document
with regards
Gaurav Singhal

SV-555:
Hi
Thanks for your request. Please provide me the code to reproduce this problem. Also try to use the latest version of Aspose.Words. You can get the latest version here:
https://releases.aspose.com/words/net
Best regards.

Hi
Thanks for your inquiry. I think that you should read document from your control into the stream and the create Aspose.Words.Document from that stream.
Best regards.