RTF document recognized as application/msword

Hello,

I have a question regarding the mime-type recognition inside Aspose.
We’re supporting multiple documents in our application, but need to do something special for RTF documents.

However, when we upload an RTF document and run it through Aspose, it’s always recognized as application/ms-word. How come Aspose cannot rely on the application/rtf, which is the standard mime-type for rtf documents?

@Olivar,

Please use the FileFormatUtil class to detect the document format and other features of the document.

FileFormatInfo info = FileFormatUtil.DetectFileFormat(MyDir + "Document.rtf");
Console.WriteLine("The document format is: " + FileFormatUtil.LoadFormatToExtension(info.LoadFormat));
Console.WriteLine("Document is encrypted: " + info.IsEncrypted);
Console.WriteLine("Document has a digital signature: " + info.HasDigitalSignature);

In case of any problems, please ZIP and upload your sample RTF document here for testing. We will investigate the issue on our end and provide you more information.

This is not what the intention is. We are using the LoadOptions, and the detection is wrong.
If a format is specified, and not accepted by Aspose, it falls back to the same call with Auto as default value.
And our code currently demonstrates that an uploaded file is being recognized by Aspose as application/ms-word, even when the document is 100% an RTF document.

Double check LoadOptions | Aspose.Words for Java for example. It’s supposed to return LoadFormat.RTF for the document used, it doesn’t. It returns LoadFormat.DOC or LoadFormat.DOCX, rendering the entire RTF detection useless.

@Olivar,

Please ZIP and upload your sample RTF document here for testing. We will investigate the issue on our end and provide you more information.

example.zip (185 Bytes)

Here you go.
One RTF file that Aspose recognises as application/ms-word

@Olivar,

This is a Plain Text (*.txt) file with .rtf extension. You can confirm that by opening it with Windows Notepad. You can also try opening real.rtf (real.zip (8.6 KB)) with Notepad to see how the content should look like. So, this is not an issue with Aspose.Words. Even MS Word 2016 detects it as a TXT file.

No, this is an issue with Aspose.words, cause the software with LoadOptions identifies that exact file as an application/ms-word

@Olivar,

example.rtf that you shared is not a RTF file. I am afraid, you can not fix the internal structure of this TXT file (with just .rtf extension) by using LoadOptions class. Even MS Word 2016 detects it as a TXT file. If we can help you with anything else, please feel free to ask.

Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end, ZIP and attach it here for testing.