Free Support Forum - aspose.com

Can I reference a merge field with table index?

Hi Roman,
Can I reference a merge field with table index? Something like
<<Table(index).fieldname>> …

Thanks,
Vikas

Also the following merge field arrangement is not working though there is data in the 8 th table (index 7) and the column name matches with the merge field name for the example :

?TableStart:7??field1_1??TableEnd:7?

The fields just get deleted. I am calling :
MailMergeExecuteWithRegions(mainDoc, objDS.Tables(7))
mainDoc.MailMerge.DeleteFields()

Please advise …

Thanks,
Vikas

Hi Vikas,

Nice to hear from you again.

1. I was not able to come up with a reasonable usage pattern to reference fields from a table by index yet. Sometime ago I proposed that if you want to mix and match fields from multiple tables you could build a wide table programmatically from your tables and send this table to mail merge. It is reasonably easy to do, can be even written into a generic function to joing tables side to side. I thought you replied it was a good idea and going for it.

2. Switch field code on for that field and make sure it is the correct field name. What you see in <<…>> can be misleading as it is a field value, not field name.