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

Free Support Forum - aspose.com

How to get mail merge field using Java

Hi,



My clients wants to know about all available mail merge fields in a document.



I read about doc.getMailMerge().getMappedDataFields() but the part ‘mapped’ confuses me.



Can I use this to retrieve -all- mail merge fields or do I need something else?



Thanks,



Marcel

Hi Marcel,

Thanks for your query. Please use following code snippet to get collection of mail merge field names available in the document. Please read following documentation link for your kind reference.

http://docs.aspose.com/display/wordsjava/MailMerge

Document doc = new Document("D:\\in.docx");
String[] fields = doc.getMailMerge().getFieldNames();

Brilliant, thank you!