Free Support Forum - aspose.com

TXT file containing zeroes can't be opened

Hi,

The attached TXT file contains zeroes instead of spaces.
Aspose.Words throws “Aspose.Words.UnsupportedFileFormatException: ‘Unknown file format: Unknown’”

I agree the file is not very correct, but applications like notepad, wordpad, MS Word can open it.296191_Zeroes.zip (1020 Bytes)

Best Regards,
Vassil

@DWProject,

Please check if the following code is acceptable for you?

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = LoadFormat.Text;
Document doc = new Document("D:\\296191_Zeroes\\296191_Zeroes.txt", loadOptions);            
doc.Save("D:\\296191_Zeroes\\18.8.docx");

loadOptions.LoadFormat = LoadFormat.Text;

This line solves the problem. Thanks!
I’ve expected it will automatically recognize it as a text format.

@DWProject,

For the sake of correction, we have also logged this problem in our issue tracking system. The ID of this issue is WORDSNET-17373. We will further look into the details of this problem and will keep you updated on the status of this issue. We apologize for any inconvenience.