Free Support Forum - aspose.com

Error saving document using Aspose.Words

When saving a particular document (attached) in Aspose.Words, I get an index out of range error. I tried removing the contents of the document to see if it was something in the content, but it didn't fix the problem. Other documents do not have the problem.

"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

HERE IS THE RELEVANT PORTION OF THE STACK TRACE:

at System.Collections.ArrayList.get_Item(Int32 index)

at xa604c4d210ae0581.x6fa6e31d93cf837a.xe84e6ff66aac2a0e(Int32 xc0c4c459c6ccbd00)

at xa604c4d210ae0581.x2b702525301ee74a.x261adce1963ad007(Int32 xc0c4c459c6ccbd00)

at xa604c4d210ae0581.x2b702525301ee74a.x1ff8ac05a72bd9dd(Int32 x18d1054d82981887, String xc15bd84e01929885)

at x9e260ffa1ac41ffa.xe397b5e25a350375.x6d5145c03507a8ad(String xc15bd84e01929885)

at x9e260ffa1ac41ffa.x163859bfa28558c4.VisitBookmarkEnd(BookmarkEnd node)

at Aspose.Words.BookmarkEnd.Accept(DocumentVisitor visitor)

at Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)

at x9e260ffa1ac41ffa.x163859bfa28558c4.x6075c9125351e131(CompositeNode x03e7e66b1eecc96f)

at x9e260ffa1ac41ffa.x163859bfa28558c4.x160a0bf4de8f6bd0()

at x9e260ffa1ac41ffa.x163859bfa28558c4.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2)

at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveFormat xd003f66121eb36a0)

at Aspose.Words.Document.Save(Stream stream, SaveFormat saveFormat)

I have opened and saved the attached document using the latest version of Aspose.Words and did not experience any problems. Please verify that you are using the latest version of Aspose.Words.

The original document I sent didn't have the problem in it. When we are about to save and upload a document from MS Word, we add bookmarks to it that we use to parse the document on the server with Aspose.Words. Once the bookmarks are there (as in the new attached document) we cannot save it with Aspose.

We are on Aspose.Words 4.2.0. We will install the latest version if you are able to save the latest document with Aspose.

Thanks for additional info. I have reproduced the problem using the new attached document. I have also found that resaving this document in MS Word 2003 fixes the prblem. Please let me know what version of MS Word you use when creating this document.

I have logged this problem to our defect base as issue #1588. We will try to fix it in our next hotfix version.

Best regards,

Vladimir Averkin
Developer/Technical Support
Aspose Auckland team

I do not know what version it was originally created in, but I was editing it in Office 2000.

Ok, I see. Thanks for the info.

Would this be fixed in the 4.2.2 "mega hotfix", or will it be coming in a subsequent hot fix?

Thanks!

Since #1588 is still open, we will try to include the fix into the next minor release.

When will this be available?

The issue is not fixed yet. I will post a notification here as soon as the fix will be available. And sorry, I cannot provide any ETA at the moment.

Best regards,

I’m getting the exact same problem (with an identical stack trace) for a document of my own. This is preventing a customer from using our application, so it is quite serious.





In my document, it appears to be some problem with footnotes. Although the document has no footnotes, if I save it as HTML I see a reference to the footnote seperator. If I open the document in Word, insert a footnote, then delete it and the seperator the document works correctly.

Hi,

Thank you for your request. Can you please attach the problematic document to test?

This file crashes on my computer when doing the following

Dim uploadDoc As New Document(myFileName)

uploadDoc.Save("C:\TestOut.doc")

Hi

Thanks for your remark. I have reproduced this bug. And I have logged this problem to our defect base as issue # 3409. We will try to fix it in our next release, which will be published in a couple of weeks. A notification will be posted here in this thread as soon as it will be done.

Best regards.

We have released a new version of Aspose.Words that contains a fix for your issue.

The new version is available at:
http://www.aspose.com/Community/Files/51/aspose.words/entry88988.aspx

Best regards

We have released a new version of Aspose.Words that contains a fix for your issue.

issue #1588 - ArgumentOutOfRangeException during document save - bookmark related.

The new version of Aspose.Words is available for download from here.

Best regards.