Error "Non-negative number required. Parameter name: count " when opening a document


#1

Hi,

I’m evaluating the latest Aspose.Word.

what could be wrong when using this code:

Dim word As New Word

Dim doc As Document = word.Open(Server.MapPath(“mydoc.doc”))

Causes following error:

Non-negative number required. Parameter name: count

Here is the stack trace:

[ArgumentOutOfRangeException: Non-negative number required.
Parameter name: count]
System.IO.BinaryReader.ReadChars(Int32 count) +151
Aspose.Word.x.a(BinaryReader A_0, Boolean A_1)
Aspose.Word.File.bs…ctor(FieldType fieldType, BinaryReader reader)
Aspose.Word.File.bp.b(bl A_0)
Aspose.Word.File.bp.a(Char A_0, Int32 A_1, bl A_2)
Aspose.Word.File.bp.b(bl A_0, a3 A_1, Int32 A_2, Int32 A_3)
Aspose.Word.File.bp.b(Int32 A_0)
Aspose.Word.File.bp.a(a3 A_0)
Aspose.Word.File.bp.c(Int32 A_0, Int32 A_1)
Aspose.Word.File.bp.b()
Aspose.Word.File.a7.a(am A_0)
Aspose.Word.Document.a(am A_0)
Aspose.Word.Document…ctor(String fileName)
Aspose.Word.Word.Open(String fileName)
Tulostustesti.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\Tulostustesti\WebForm1.aspx.vb:29
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

Thanks,

Teemu Keiski


#2

To add that I found out one similar issue on this forum and it was fixed by a hotfix.
So is it also a stylesheet without formatting instructions which can cause it? How can I detect such stylesheet to remove it?


#3

You just need to send the file to me to word@aspose.com and we will check what’s going on.


#4

Thanks,

I just sent it in. Has it arrived?

Teemu Keiski


#5

Hi,

This was caused by form field stored in some format that we didn’t know about. Fixed this, just get latest Aspose.Word 1.9.1.


#6

Great, fast service you have, thanks!