We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded

I’m using Aspose.Words version 15.11.0 and try to extract text document from html document and facing bellow error:


Aspose.Words.FileCorruptedException:
The document appears to be corrupted and cannot be loaded. —>
System.IndexOutOfRangeException: Index was outside the bounds of the array.

at Microsoft.BizTalk.Message.Interop.StreamViewOfIStream.Read(Byte[] buffer, Int32 offset, Int32 count)

at . ()

at . ()

at ..ctor(Stream )

at .(Stream )

at Aspose.Words.Document.(Stream , LoadOptions )

--- End of inner exception stack trace ---

at Aspose.Words.Document.(Stream , LoadOptions )

at Aspose.Words.Document.(Stream , LoadOptions )

at Aspose.Words.Document..ctor(Stream stream, LoadOptions loadOptions)

at Aspose.Words.Document..ctor(Stream stream)



Below is my code:

public string ExtractDocument(Stream stream)

{

stream.Seek(0, SeekOrigin.Begin);

var doc = new Document(stream);

return doc.ToTxt();

}


Can anybody help please.

Hi there,


Thanks for your inquiry. Could you please attach your input document here for testing? We will investigate the issue on our side and provide you more information.