Using latest .Net2 DLL version 14.8.0 when opening the attached Word document with Load Options LoadFormat set to Auto or Docx I get:
“The document appears to be corrupted and cannot be loaded.”
If the document is opened without the Load Options the error does not occur.
Dim AsposeLoadOptions As New Aspose.Words.LoadOptions(Aspose.Words.LoadFormat.Auto)
If Not String.IsNullOrEmpty(iPassword) Then AsposeLoadOptions.Password = iPassword
nDoc = New Aspose.Words.Document(_DocumentPath, AsposeLoadOptions)
pCount = nDoc.PageCount
Catch ex As Exception
pCount = 0
(The document is an extract from a much larger document; the same error occurs with both documents)
Thanks for your attention
Thanks for the reply.
I’ve downloaded the actual uploaded docx from this posting and tried again and it fails the same.
I’ve downloaded your out-aw-14.8.0.docx and that fails with same message. Please see attached screen capture jpg from VS2010 from Function at point of failure with immediate window showing input path and output exception.
Full size original document still fails but I cannot upload that as it is confidential.
I have another document that fails the same Doc1(18).docx, also attached.
Please note all open fine when not using LoadOptions.
V2010 console solution that reproduces error is in the AposeWordsDocOpenFault.zip file at the attached url.
I’ve removed the Aspose.Total.lic from the zip, therefore VS2010 will show the file as missing from 2 locations.
If you are still unable to repro the problem, perhaps you have a debug instance of the dll or a version that does logging that I could use locally?
OpenAsposeWordDocument(ByVal path As String, ByRef strErrorMessage As String, Optional ByVal iPassword As String = “”) As Aspose.Words.Document
Dim nDoc As Aspose.Words.Document = Nothing
'jrm with version 14.8 Aspose.Words.dll we may get "The document appears to be corrupted and cannot be loaded" when using LoadOptions LoadFormat=Auto or Docx, so we may not be able to use passwords till this is fixed
Dim AsposeLoadOptions As New Aspose.Words.LoadOptions()
AsposeLoadOptions.LoadFormat = Aspose.Words.LoadFormat.Docx
'If Not String.IsNullOrEmpty(iPassword) Then AsposeLoadOptions.Password = iPassword
nDoc = New Aspose.Words.Document(path, AsposeLoadOptions)
Catch ex As Exception
'jrm - try to open without the LoadOptions
strErrorMessage = "With Load Options " & ex.Message
nDoc = New Aspose.Words.Document(DocumentPath)
strErrorMessage += vbCrLf & "OK without Load Options"
Catch ex2 As Exception
strErrorMessage += ex.Message
OpenAsposeWordDocument = nDoc