I want to convert a RTF file to PDF, via following code:
string strFileName = @"C:\_Recotest2\test.rtf";
LoadOptions loadoptions = new LoadOptions();
loadoptions.LoadFormat = LoadFomat.Rtf;
Document doc = new Document(strFileName,loadoptions);
When I run ths code I get following exception:
Aspose.Words.UnsupportedFileFormatException: Unknown file format.
I have the test.rtf-file attached.
What is wrong here?
Hi
Philip,
Thanks for your inquiry.
I have found that the input document you provided here is not in RTF format instead it is a simple TXT file. Currently, Aspose.Words supports saving documents as plain text files, but does not directly support loading them. However, it is easy to write your own code to load plain text files into Aspose.Words. Please use the code suggested in the following article to load text files:
https://docs.aspose.com/words/net/create-or-load-a-document/
Please let me know if I can be of any further assistance.
Best Regards,