Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded
Posted 棉晗榜
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded相关的知识,希望对你有一定的参考价值。
开发环境
- C#
- .NET 6
- Aspose.Words 18.7
- 控制台程序
异常消息:
Unhandled exception. Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
—> System.NullReferenceException: Object reference not set to an instance of an object.
at ??..ctor(Stream , Encoding )
at ???.(Stream , Encoding )
at Aspose.Words.Document.(Stream , LoadOptions )
— End of inner exception stack trace —
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document.()
at Aspose.Words.Document…ctor(Boolean )
at Aspose.Words.Document…ctor()
at Program.$(String[] args) in D:\\WorkTest\\ConsoleAppWordTohtml\\ConsoleAppNET6.0\\Program.cs:line 9
解决办法:
多半是程序字符集问题,因为用的.net core 6,所以没有初始化字符集
使用如下代码注册字符集:
以上是关于Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded的主要内容,如果未能解决你的问题,请参考以下文章