Need to Remove table row on specific condition if value is not present

I am using Aspose.Total.Java with Aspose word 19.4 version.
Need to remove the rows from the table if the values for the row column field is empty or null.

We tried using the doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_TABLE_ROWS);

before our doc.getMailMerge().execute() (94.1 KB)


In your case, we suggest you please implement IFieldMergingCallback interface, get the table’s row as shown below and remove it based on the value of ‘Send Service’. You can remove the row using Row.Remove method. Hope this helps you.

class FieldMergeCallback implements IFieldMergingCallback {

    public void fieldMerging(FieldMergingArgs e) throws Exception {
        Row row = (Row)e.getField().getStart().getAncestor(NodeType.ROW);

    public void imageFieldMerging(ImageFieldMergingArgs args) throws Exception {

Thank you it helped to resolve one of our row deletion problem.