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

Free Support Forum - aspose.com

Unable to cast object of type 'Aspose.Words.BookmarkStart' to type 'Aspose.Words.Drawing.Shape'

Hi Team,

When i’m trying to create a instance of Aspose.Words.Document, i’m getting the below error.

"Unable to cast object of type ‘Aspose.Words.BookmarkStart’ to type ‘Aspose.Words.Drawing.Shape’"

{System.InvalidCastException: Unable to cast object of type ‘Aspose.Words.BookmarkStart’ to type ‘Aspose.Words.Drawing.Shape’.
at Aspose.Words.Document.x5d4db34d48fb3129(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document.x5d95f5f98c940295(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document…ctor(String fileName, LoadOptions loadOptions)
at Aspose.Words.Document…ctor(String fileName)

Any idea what went wrong here ? As the document i have tried contains confidential data, i’m not able to upload here. I’m trying to simulate the above error with sample document which i could not succeed. Please advise.

Note: The document contains many hidden bookmarks. Deleting the hidden bookmarks randomly with MS Office solves the problem. The same document can be opened using word automation and openXML without any issues.

The below URL may help which causing the problem. Not sure.


If i removed the hidden bookmarks, then i dont have any issues in loading the document.
Hi Senthil,

Thanks for your inquiry.

Unfortunately, it is difficult to say what the problem is without the document(s) and piece of code. I need your document and code to reproduce the same exception on my side. Please note that it is safe to attach files in the forum. If you attach your document here, only you and Aspose staff members can download it. Also you can send the file to my e-mail as described here:
You can also remove any sensitive information by replacing it with dummy data instead.

Best regards,

Hi Awais,

I have attached 2 sample documents for your testing. To my understanding, both documents having the same issue when updating the table of contents manually but trying to open one of the document using Aspose object, i’m getting the cast exception error . I didnt face any issues with the other document.

The zip file contains 2 documents

TestSample_InvalidCastException.docx - Cast Exception thrown
TestSample_Working.docx - No issues

Please find the code snipped i have used.

Aspose.Words.Document wordDocument = new Aspose.Words.Document(filePath);
result = wordDocument.Range.Text;

Please note that i’m able to open both the documents without any issues using normal word automation and open xml.

Hope the above attachments will help you.

Hi Awais,

Did you get time to look into the above issue ?


Any response will be highly appreciated.

Hi Senthil,

Thank you for being patient.

While using the latest version of Aspose.Words i.e. 13.6.0, I managed to reproduce this exception on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-8577. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Hi Senthil,

We have a good news for you that is WORDSNET-8577 has now been resolved and it’s fix will be included in the next release of Aspose.Words (13.7.0) which is planned to be released by the end of July 2013. We will inform you via this thread as soon as the new release of Aspose.Words is published.

Best regards,


Happy to here the news. Thanks for resolving the issue within a short interval time. Greatly appreciated !!!

The issues you have found earlier (filed as WORDSNET-8577) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.