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

Free Support Forum - aspose.com

Aspose.Words.FileFormatUtil.DetectFileFormat stopped working after Aspose.Cells update


While updating from version 20.1 to 20.7 for Aspose.Cells and Aspose.Words encountered an error.
We’re creating the Workbook using Aspose.Cells and later checking with Aspose.Words whenever we will be able to open it. We’re calling the following code:

originalInputStream.Position = 0;
var wordsFormat = Aspose.Words.FileFormatUtil.DetectFileFormat(originalInputStream);

The error is that Aspose.Words 20.1 and 20.7 are able to do the following call if Workbook was created using Aspose.Cells of version 20.1, while if we create the workbook using Aspose.Cells 20.7 we’re getting:

The document appears to be corrupted and cannot be loaded.
----> \u0008​ : ZipEntry::ReadDirEntry(): Bad signature (0x6F707341) at position 0x00001A1F
at Aspose.Words.FileFormatUtil.DetectFileFormat(Stream stream)


Could you please ZIP and attach your your Word document and code example that you are using to reproduce this issue at our end? We will investigate the issue and provide you more information on it.

Hello. To reproduce the issue I’ve created the simplest console program example. Sharing with you the Program.csProgram.zip (693 Bytes).
Note: versions of both Aspose.Cells and Aspose.Words are 20.7


Please note that Excel document is not supported by Aspose.Words. The GDocsFileDto method saves the Excel document into stream and FileFormatUtil.DetectFileFormat is used to detect file format. It returns ‘Unknown’ which is expected output.

Please read the supported document format by Aspose.Words from here:
Supported Document Formats


The thing, that it doesn’t return “Unkown” state. It throws an error:
image.png (29.6 KB). To get the Aspose.Words.LoadFormat.Unknown state is the expected behavior here, but the error is not something to be happy with, as this way we would have to check all existing supported file extensions manually, what is, obviously not the best solution


We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20799 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like

The issues you have found earlier (filed as WORDSNET-20799) have been fixed in this Aspose.Words for .NET 20.8 update and this Aspose.Words for Java 20.8 update.