Free Support Forum - aspose.com

How to change the bookmark value when cell cloning

Hi, everyone.


I am trying cloning the table and paste immediately after the table.

The original table has its own bookmark value in each cell.
The bookmark value is the bookmark value under Text Form Field Options in developer mode of MS word.

How to change the each cell’s bookmark value when doing the table clone?



Row clonedRow = (Row)table.getFirstRow().deepClone(true);
Row clonedRow1 = (Row)table.getLastRow().deepClone(true);
table.appendChild(clonedRow);
table.appendChild(clonedRow1);
table.appendChild(clonedRow);
table.appendChild(clonedRow1);
table.getParentNode().insertAfter(new Paragraph(doc), table);

Hi Kai,

Thanks for your inquiry. Please note that Aspose.Words mimics
the same behavior as MS Word does. MS Word allows only unique names for
bookmarks. If you change the name of a bookmark to a name that already
exists in the document, no error will be given and only the first
bookmark will be stored when you save the document. When you add a
cloned Paragraph into the document, its bookmark will not be stored due
to same name.

It would be great if you please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document.

We
will investigate how you want your final Word output be generated like.
We will then provide you more information on this along with code.