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

Free Support Forum - aspose.com

"InvalidOperationException: Expected 1 bit per pixel only here" when opening RTF file

rtf2.zip (5.7 KB)

When opening an RTF file with Aspose.Words.dll (version 21.7) the following error occurs:

Aspose.Words.FileCorruptedException
  HResult=0x80131500
  Message=The document appears to be corrupted and cannot be loaded.
  Source=Aspose.Words
  StackTrace:
   at Aspose.Words.Document.(Stream , LoadOptions )
   at Aspose.Words.Document.(Stream , LoadOptions )
   at Aspose.Words.Document..ctor(Stream stream, LoadOptions loadOptions)
[ETC]

Inner Exception 1:
InvalidOperationException: Expected 1 bit per pixel only here.

The code used for opening the file is as follows:

var document = new Aspose.Words.Document("rtf2.rtf");

Please find attached the problematic file. It is in fact not corrupted because MS Word opens it and displays it correctly.

Let us know if we can expect a fix for this.

@Eva_M Thank you for reporting this problem to us. I have managed to reproduce it on my side and logged it as WORDSNET-22980 in our defect database. We will keep you informed and let you know once the issue is resolved.

The issues you have found earlier (filed as WORDSNET-22980) have been fixed in this Aspose.Words for .NET 21.12 update also available on NuGet.