But when the text is empty ( click the mouse right button——create a new text without typing anything), converting txt to xps will lead to NullReferenceException.
Please help me solve the problem as soon as possible.
Thanks for your inquiry. The file created by using (right-click > new > Word Doc) has file size 0k. This is not a bug in Aspose.Words. In this case, the file with zero length has no header. All object files have the header by which one can understand that the format and version of the format.
In .TXT file format, there is no such header. So if the file size is zero, we can not be sure about its format. You can check the file size before loading it into Aspose.Words.Document.
FileInfo f = new FileInfo(MyDir + "in.txt");
long size = f.Length;
Hope this answers your query. Please let us know if you have any more queries.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.