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

Free Support Forum - aspose.com

Conversion from RTF to HTML

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

I get the following stacktrace.
com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.a(FileFormatUtil.java:129)
at com.aspose.words.Document.b(Document.java:1298)
at com.aspose.words.Document.a(Document.java:1167)
at com.aspose.words.Document.(Document.java:200)
at com.aspose.words.Document.(Document.java:171)
at com.aspose.words.Document.(Document.java:166)

Caused by: java.lang.NullPointerException
at com.aspose.words.amj.akB(RtfContentHandler.java:77)
at com.aspose.words.ams.akB(RtfFileHandler.java:50)
at com.aspose.words.aoi.amy(RtfReader.java:128)
at com.aspose.words.aoi.read(RtfReader.java:74)
at com.aspose.words.Document.b(Document.java:1228)
… 11 more

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.rtf”;
FileInputStream fis = new FileInputStream(rtfFileName);
Document doc = new Document(fis);

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

Hi Daniel,


Thanks for your inquiry. I managed to reproduce this exception on my side. I have logged this issue in our bug tracking system. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for inconvenience.

As a temporary work around, I would suggest you please open this RTF file using MS WORD and save as again to RTF format. Then please try loading this newly saved RTF document using Aspose.Words for further document processing tasks. I hope, this will help.

Best Regards,

The issues you have found earlier (filed as WORDSNET-5942) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.