Free Support Forum - aspose.com

Specified argument was out of the range of valid values. Parameter name: value

Hello,

I am getting an exception from aspose when trying to load a word document from a stream. I've included the document as an attachment and this is all the relevant code we use in regards to this file.
To test it al you need to do is create a webproject and drop a fileuploadbox and button to submit on a form (due to the structure of our project we use the findcontrol function to locate the uploadbox. adjust the name of uplFile to the name of your fileuploadbox).
I am using aspose.words version 3.7.1.0 which is, as far as I know, the lastest version.

-----
Dim PostedFile As System.Web.HttpPostedFile = CType(Page.FindControl("uplFile"), System.Web.UI.HtmlControls.HtmlInputFile).PostedFile

Dim Filename As String = System.IO.Path.GetFileName(PostedFile.FileName)

PostedFile.SaveAs("C:\temp\" & Filename)

Dim doc As Aspose.Words.Document = New Aspose.Words.Document(PostedFile.InputStream)
-----

The error message:

Source Error:
Line(30) : Dim Filename As String = System.IO.Path.GetFileName(PostedFile.FileName)
Line(31) : PostedFile.SaveAs("C:\temp\" & Filename)
Line(32) : Dim doc As Aspose.Words.Document = New Aspose.Words.Document(PostedFile.InputStream)

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value]
Aspose.Words.ListLevel.set_RestartAfterLevel(Int32 value)
ഁ.᝾.ជ(ListLevel ឈ)
ഁ.᝾.ច(ၸ ၩ)
ഁ.᝾.ខ()
ഁ.᝾.֟(ᅗ ᏾, BinaryReader ֠)
ᄹ.ᄸ.֟()
Aspose.Words.Document.෾(Stream ղ, String भ)
Aspose.Words.Document.ڴ(Stream ղ, LoadFormat ෼, String भ)
Aspose.Words.Document..ctor(Stream stream, String baseUri, LoadFormat loadFormat, String password)
Aspose.Words.Document..ctor(Stream stream, String baseUri)
Aspose.Words.Document..ctor(Stream stream)
Testproject.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\Testproject\WebForm1.aspx.vb:32
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

The issue is fixed in version 4.0 beta which is now available for download. Please try your app with the new version.

Best regards,

Version 4 beta fixed it indeed, many thanks.

But I'd like to ask what the problem was with the document. Until my company can find some time to test this beta enough to push it to live servers I'd like to be able to present a workaround for the time being. Something like "don't draw a line in your document" or "no headercells in tables" or somesuch.

With kind regards,
Sander Baaij

Unfortunately there is no simple workaround for this. The problem was caused by incorrect handling of some types of list definitions in the document. And list definitions are somewhat 'hidden' in the document file and cannot be easily controlled from MS Word. You can have a completely empty document with hundreds of list definitions hidden inside.

Best regards,

Well, we'll have to hurry with the testing then ;)
Thanks for the timely repsonse.

With kind regards,
Sander Baaij