linkedinfacebooktwittermenuarrow-up

GemBox Support Forum

Magic Number not found in file

C# code, when load document
document = DocumentModel.Load(new MemoryStream(data) , LoadOptions.DocDefault); in runtime return an error “Magic Number not found in file. Found: 6001404034B50”

“GemBox.Document” v35.0.1020 (we have a license for version 23.3.30.1260) resultat the same “Magic Number not found …”. I can open file with Microsoft Word (DOC, DOCX)

This error indicates that the file you’re loading is not of DOC format.

Note that even though the file might have a “.doc” extension, it could be of some other format and Microsoft Word will be able to open it.
However, in most cases it will show a warning saying that the file’s extension and format do not match.

Anyway, try opening your file in some text editor (like Notepad++), what do you see?
Is it perhaps an HTML or XML content?

Last, note that if you don’t specify the load options by using this DocumentModel.Load(String) or this DocumentModel.Load(Stream) overload method then GemBox.Document will inspect the provided file and choose the appropriate load options.