Free Support Forum - aspose.com

Getting an UnsupportedFileFormatException trying to open a text file

Hi,


I am getting an UnsupportedFileFormatException trying to open a text file for no obvious reason.

I have attached a masked copy of the text file in question which still produces the same issue.

I am using the latest version of Aspose.Words

Regards
Trent

Hi Trent,


Thanks for your inquiry. Please use the following code snippet to load your txt file and read the members of LoadOption class from here:
http://www.aspose.com/docs/display/wordsnet/LoadOptions+Members

<span style=“font-size:
10.0pt;font-family:“Courier New”;mso-no-proof:yes”>Aspose.Words.LoadOptions loadOptions = new
Aspose.Words.LoadOptions();<o:p></o:p>

loadOptions.LoadFormat = LoadFormat.Text;

loadOptions.Encoding = Encoding.Default;

Document doc = new Document(MyDir + "test-masked.txt", loadOptions);