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

Free Support Forum - aspose.com

Load html file fails with exception document appears to be corrupted

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.:heart:(Stream :slight_smile:, LoadOptions :heart:)
at Aspose.Words.Document.:slight_smile:(Stream :slight_smile:, LoadOptions :heart:)
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 :clubs: ? .:clubs:(Int32 :slight_smile:)
at :slight_smile: ? .:clubs:()
at ♫ ? .:heart:(Int32 :slight_smile:)
at ♫ ? .:slight_smile:(ArrayList :slight_smile:, Int32 :heart:)
at ♫ ? .:slight_smile:(ArrayList :slight_smile:, :heart: :heart:, Int32 :clubs:, Boolean, Boolean :spades:)
at :spades: ? .:spades: (Table :slight_smile:)
at :spades: ? .:slight_smile:(Table :slight_smile:, Boolean :heart:)
at?? .:slight_smile:(Table :slight_smile:, Stack :heart:, Boolean :clubs:)
at?? .VisitTableEnd(Table :slight_smile:)
at Aspose.Words.Tables.Table.r3ka8zscesabkstb24kjjv9sml9wq7pw? :heart:(DocumentVis
itor :slight_smile:)
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?? .:slight_smile:(Document :slight_smile:, LoadOptions :heart:)
at Aspose.Words.Document.:heart:(Stream :slight_smile:, LoadOptions :heart:)
Hi Chris,

Thanks for your inquiry. Unfortunately, we have not found any attachment with your post. Could you please attach your input HTML here for testing? We will investigate the issue on our side and provide you more information.

I have re-added the zip file. It contains two directories: htmlFiles contains two .htm files that give the corrupted file exception and testHtmlLoad contains small test app so that you can easily reproduce the problem …

Hi Chris,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15224. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@cschettle,

The issues you have found earlier (filed as WORDSNET-15224) have been fixed in this Aspose.Words for .NET 17.9 update and this Aspose.Words for Java 17.9 update.