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

Free Support Forum - aspose.com

InsertField truncating MERGEFIELD name

The names I’m assigning to merge fields seem to be truncating at 40 characters. Using the following:

doc.InsertField(“MERGEFIELD ThisIsAVeryLongNameGreaterThanFortyCharacters * MERGEFORMAT”), “”);

the resulting document has a merge field name of


I have use a large library of word documents and going though each document and changing the merge field names to less than 40 characters is not really an option.

Is there a way around this 40 character name limitation?

Hi Steve,

Thanks for your inquiry.

It appears from details in a recent thread that MS Word truncates a field with more than 40 characters. This is a limitation of Microsoft Word as if you insert a long field using MS Word you will see the same behaviour as well.

Please note that it's only the field result being truncated, the actual merge field name is still there in full (you can check by toggling field codes by pressing ALT+F9). This means mail merge functions will still work correctly.