We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Word for C#.NET 加载docx格式文件时,实例化Document对象时报错

目前使用的是Aspose.Words最新稳定版:21.11.0

源代码如下:
using (var fileStream = new FileStream(@“D:\1.docx”, FileMode.Open, FileAccess.Read, FileShare.Read))
{
Document doc = new Document(fileStream);
}

测试文件:1(1).docx (13.7 KB),如果将此docx文件转换为doc格式的话,整个程序则正常。

异常信息:Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded. —> System.InvalidOperationException: Cannot find part ‘/NULL’.
在 ​ .(String )
在 .( )
在 . ()
在 .()
在 .()
在 .()
在 Aspose.Words.Document.(Stream , LoadOptions )
— 内部异常堆栈跟踪的结尾 —
在 Aspose.Words.Document.(Stream , LoadOptions )
在 Aspose.Words.Document.(Stream , LoadOptions )
在 Aspose.Words.Document…ctor(Stream stream, LoadOptions loadOptions)
在 myDoc.Business.Converter.WordConverter.Do(FileInfo fi)
在 myDoc.Business.DocWorker.b__6_0()

@BruceGOGO I have managed to reproduce the issue on my side and logged it as WORDSNET-23187. We will keep you informed and let you know once it is resolved.

The issues you have found earlier (filed as WORDSNET-23187) have been fixed in this Aspose.Words for .NET 22.1 update also available on NuGet.