Merging Word Table cell - by using MailMerge


#1

Hi Aspose.Words team,

Currently, I am using Mail merge with regions to populate data into a Word Table.

My question is, how do I merge the Word table cell when using Mail merge process? (i.e. merging 3 cells into 1 cell, so I could populate the data in this merged cell). I want to place a "title text" into this merged cell.

I am just wondering, if I could use the "MergeFieldEventHandler" to control word table cell formating?

Thank you.

Regards,

Jarry


#2

Yes, MergeField event handler can be used to format cell. To locate cell that contains field that triggered MergeField event use DocumentBuilder. For example,

DocumentBuilder builder = new DocumentBuilder(e.Document);

builder.MoveToMergeField(e.DocumentFieldName);

Cell cell = (Cell)builder.CurrentParagraph.GetAncestor(typeof(Aspose.Words.Cell));

Regards,


#3

Thanks Vladimir,

I works perfectly.

Cheers,

Jarry