RTF conversion to HTML issue

Hello,
I’m trying to convert attached RTF file into HTML.

I get the following stacktrace.
Exception in thread “main” com.aspose.words.UnsupportedFileFormatException: Unknown file format.
at com.aspose.words.Document.b(Unknown Source)
at com.aspose.words.Document.a(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.browsersoft.adapterkit.rtf2html.TestAspose.testAsposeEntity(TestAspose.java:40)
at com.browsersoft.adapterkit.rtf2html.TestAspose.main(TestAspose.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

Is the RTF I’m trying to convert corrupt? It seems to open fine in RTF editors. Or maybe a bug?


Thank you very much for any help!
-Daniel


Following is the code I’ve used for the conversion:

String rtfFileName = “test_2.rtf”;
FileInputStream fis = new FileInputStream(rtfFileName);
Document doc = new Document(fis);

doc.save(rtfFileName + “.html”, SaveFormat.HTML);
System.out.println(“HTML files Created.”);

Hi there,

Thanks for your inquiry.

Perhaps, you are using an older version of Aspose.Words; as with Aspose.Words v13.8.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v13.8.0 and let us know how it goes on your side. I hope, this will help. I have attached the output Html file with this post for your kind reference.

Hi,
That was the issue, I was on an older version.
Appreciate the help and quick response!

Hi there,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.