hi how to include multiple values to single merge field
using aspose words java?
hi how to include multiple values to single merge field
using aspose words java?
Hi,
Document doc = new Document(getMyDir() + “in.docx”);
doc.getMailMerge().setFieldMergingCallback(new HandleMergeField());
doc.getMailMerge().execute(new String[]{“mf”}, new Object[]{“Hello”});
doc.save(getMyDir() + “15.10.0.docx”);
static class HandleMergeField implements IFieldMergingCallback
{
public void fieldMerging(FieldMergingArgs e) throws Exception
{
if (e.getFieldName().equals(“mf”)) {
Document doc = (Document) e.getDocument();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveToMergeField(e.getFieldName());
builder.write(e.getFieldValue().toString() + " " + “World”) ;
}
}<font color="RED"><b>public</b></font> <font color="RED"><b>void</b></font> imageFieldMerging<font color="BLUE"><b>(</b></font>ImageFieldMergingArgs args<font color="BLUE"><b>)</b></font> <font color="RED"><b>throws</b></font> Exception <font color="BLUE"><b>{</b></font> <font color="GREEN"><i>// Do nothing.
}
}