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

Free Support Forum - aspose.com

Shown label of merge field

Hello,

MS Word has a feature to change label of a merge field.
For example, originally when you insert a merge field “TestField” its shown label is «TestField».
But it is possible to change a shown text to name (even without parentheses!).

Please see attached the sample documents (original and with replaced label).
FieldLabels.zip (19.9 KB)

Question: Is is possible using Aspose.Words API to change a label of merge field as it is mentioned above?

Best regards,
Evgeniy

@konfetov,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior of MS Word. You can get or set the result of field using Field.Result property. However, when you update the mail merge field you will get the result as «TestField». Please check the following code example.

Document doc = new Document(MyDir + "Field1.docx");
Field field = doc.Range.Fields[0];
field.Result = "Name";

doc.Save(MyDir + "17.10.docx");

Tahir,
Thanks a lot, this works!

Best regards,
Evgeniy