Attempted to clone a by reference attribute '16'- but the attribute does not expose the complex attribute interface

I have a method to which I pass the Document, a bookmark name and a boookmark value.

I look for the bookmark name and replace it’s text with the bookmark value passed into the method

Not if I have a single bookmark it works just fine, but when I add another bookmark it displays this error within the aspose word component

“Attempted to clone a by reference attribute ‘16’, but the attribute does not expose the complex attribute interface.”

public void InsertBookmark(ref Document newDoc, string bookmarkName, string bookmarkValue)
    Bookmarks bookmarks = newDoc.Range.Bookmarks;
    Bookmark bookmark = bookmarks[bookmarkName];
    bookmark.Text = bookmarkValue;

I have looked at the objects and the bookmarkobject is not null, and everything seems to be ok.

The environment I am working on is XP with VS2005 C#

Any ideas would be appreciated.

Further more, If I have just one bookmark it works just fine, but the problem is only present when there are multiple bookmarks


Thank you for considering Aspose.

Please attach the problematic document you are working with.

I get the same error message and I’m not using bookmarks. Environment is VB.Net and Aspose.Word 3.1.7

I have a simple test document and I’m trying to mail merge in 2 passes from 2 different data tables.

The template has 3 simple fields at the top followed by a repeating set of fields in a repeating region as per the Aspose documentation.

For the test, I invoke the 2 passes individually with 2 different buttons. The merge works fine on the first pass, but throws the “Attempted to clone a by reference attribute ‘16’…” exception on the second pass.

The order in which the passes are invoked makes no difference. The first merge always works and the second merge always fails.

I tried different combinations of MailMerge.Execute(DataTable) and MailMerge.ExecuteWithRegions(DataTable) but get the same result.

Any suggestions?

I’ve resolved my problem and here’s what I found…

As long as I call the mailmerge execution methods one after the other without any other Aspose methods in between, the merge works. If I insert a call such as the Save() method in between the two merge executions, I get the exception.



the above snippet generates the runtime error, but if I move the merge calls together the merge calls work fine. (see below)


So for me at least, I know how to resolve. Hope this helps to track down the problem for other users.

I am getting the same error. Here is the stack trace ->

Exception: System.Exception Message: Attempted to copy a by reference attribute ‘16’, but the attribute does not expose the complex attribute interface. Source: Aspose.Word at ?.?.?(Int32 ?) at ?.?.?() at Aspose.Word.DocumentBuilder.?(? ?, Boolean ?) at Aspose.Word.DocumentBuilder.MoveTo(Node node) at Aspose.Word.DocumentBuilder.?(? ?) at Aspose.Word.DocumentBuilder.MoveToMergeField(String fieldName)

The error is occurring when i call ‘builder.MoveToMergeField(fieldName);’

Unfortunately, I don’t have the luxury as ijoubert because my code is too complicated. Dmitry, please help!

Thanks in advance,

Oh, by the way. I am running v



Please attach the problematic document so we can reproduce the issue. And could you also specify the name of the merge field which is passed to builder.MoveToMergeField that throws?

Hi Dmitry,

I’ve attached the form per your request. The name of the field it was occurring on is ‘Title’. I’ve determined that if I use MSWord to delete the bad fields and then recreate them, the problem seems to go away. I have many documents, so I was hoping I wouldn’t have to do this for all of them.

Also, this problem seems to be intermittent. I have two development boxes, both are the same setup, one sees the problem every time and the other isn’t affected. Also, our staging environment works fine, but it fails in production.

I have rolled back to v2.3 and it is working fine in all environments.

Kind Regards,



We need a document to be able to reproduce. Please attach it to a post here.

trying to post the file again…

Now it’s here, looking into it.

We’ve just released Aspose.Word 3.2.1.

  • Fixed exception “Attempted to copy a by reference attribute ‘xxx’”.

Hi I was getting this error in my document, from a position onwards, didnt matter what i did, i put a bookmark in and try to use


I got the error described.

So i’ve followed your instructions and upgraded and now my document behaves completely differently. 100% of what im doing in code is

  1. deleteing whole sections, or

  2. replacing text in sections

and for both i’m using bookmarks. for deleteing a section i’m using


This worked beautifully before the upgrade. Now it appears to ignore the section the bookmark resides, instead it starts deleting sections from the top of the document one by one.

Initially I had been navigating to sections by ordinal, but of course when you delete one, all the ordinals get updated and this became a nightmare to manage.

Help! Thanks!

p.s. sorry the text of the post is so big, im setting it to arial size 1, but it comes out massive

in fact stepping through the code, and doc.Saving, everything is fine up until exactly the same point as the error was happening before

basically after the last bookmark / section on page 6 “Assessment Centre”, i try to access the first bookmark on page 7 “ServiceFee” and delete it and this deletes my first page

in code ive deleted loads of sections (which in turns deletes some pages), ill attach all 3 files, before, before problem and after problem

i’ve had to delete the attachment because i saw it hyperlinked. its quite sensitive. will post to as

It seems that ‘before prob’ and ‘after prob’ docs are interchanged, because ‘after prob’ has the ‘Hudson Proposal’ section and ‘before prob’ doesn’t. In my test the lines



correctly remove the section containing the “ServiceFee” bookmark and I have tested on all three files.

My guess of what is happening is that you sometimes try to move to bookmark contained in section that was already removed. As a result DocumentBuilder position is not moved.

Consequently, executing DocumentBuilder.CurrentParagraph.ParentSection.Range.Delete() leads to the removal of the section pointed by previous position of DocumentBuilder which depends of your previous actions with DocumentBuilder.

To check this supposition try to insert the Bookmark existence check, like


MessageBox.Show(“Bookmark not found!”);