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,
That was the issue, I was on an older version.
Appreciate the help and quick response!
Hi there,