I recently updated from Aspose.Words.Net v16.7.0 to Aspose.Words.Net v17.4.0 I have valid HTML files that loaded perfectly in v16.7.0 but with v17.4.0 I get the following exception:
Exception message: The document appears to be corrupted and cannot be loaded. (see full exception details below). The attached htm files can be opened with MS Word 2013 without problems. They also open in browsers without issue. The main reason we use Aspose is to convert and compare html files. This problem makes Aspose.Words.Net v17.4.0 unusable for our application.
Here is the code that I use:
string docFullName = “abc2016.htm”;
// load options for Aspose 16.7.0
//LoadOptions lo = new LoadOptions();
// lo.LoadFormat = LoadFormat.Html;
// load options for Aspose 17.4.0
HtmlLoadOptions lo = new HtmlLoadOptions();
Document aspDoc = new Document(docFullName, lo);
The new Document line gives the exception. The attached zip file contains the html files that give the exception along with a very simple VS 2013 C# windows app that reproduces the exception.
Exception message: The document appears to be corrupted and cannot be loaded.
Exception stack trace: at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document…ctor(String fileName, LoadOptions loadOptions)
at testHtmlLoad.Program.Main(String[] args) in d:\forAsposeForum\htmlLoadIssu
es\testHtmlLoad\Program.cs:line 35
Inner Exception: System.ArgumentOutOfRangeException: Specified argument was out
of the range of valid values.
Parameter name: value
at ? .(Int32 )
at ? .()
at ♫ ? .(Int32 )
at ♫ ? .(ArrayList , Int32 )
at ♫ ? .(ArrayList , , Int32 , Boolean, Boolean )
at ? . (Table )
at ? .(Table , Boolean )
at?? .(Table , Stack , Boolean )
at?? .VisitTableEnd(Table )
at Aspose.Words.Tables.Table.r3ka8zscesabkstb24kjjv9sml9wq7pw? (DocumentVis
itor )
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Section.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Document.Accept(DocumentVisitor visitor)
at?? .(Document , LoadOptions )
at Aspose.Words.Document.(Stream , LoadOptions )