Free Support Forum -

Rendering twice with mergefield and bookmark


I have a document with a bookmark and a mergefield with the same name: ‘osinumero’. I use Aspose.Words for JAVA to render a text using mergefield. My problem is that Aspose renders the text twice. It is supposed to be that only render one because we use the mergefield and not the bookmark.

My code line to render is:

documento.getMailMerge().execute(new String[]{mymergefield}, new Object[]{text});

where mymergefield has mergefield’s name: ‘osinumero’ and text is the text to render.

Can you help me please?

Thanks in advance.

Hi Johnnatan,

Thanks for your inquiry.

This behaviour is occuring because your document actually contains two merge fields called "osinumero". The second field has no field result so it does not normally appear visible in the document. You can view this field by toggling field codes (ALT+F9). The fix is to remove this second field from the document.

If I can help with anything else, please feel free to ask.



I didn’t notice that, thanks for your help!