Thanks for your inquiry.
You're right, that example code it a bit limiting if you have more than one table. I have written a quick implementation which works with the rows of the table directly. It alternates the colors of the rows in the Attributes tables during merging. Please see the code below:
void IFieldMergingCallback.FieldMerging(FieldMergingArgs e)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
// The row which contains this mergefield.
Row row = (Row)e.Field.Start.GetAncestor(NodeType.Row);
// The parent table of this row
Table table = row.ParentTable;
// Find the index of the row in the table.
// Subtract 1 off the index of the row in order to take into account the header row.
int remainder = (table.IndexOf(row) - 1) % 2;
foreach (Cell cell in row.Cells)
if (remainder == 0)
// Even row
cell.CellFormat.Shading.BackgroundPatternColor = Color.Blue;
// Odd row
cell.CellFormat.Shading.BackgroundPatternColor = Color.LightBlue;
If you have any other inqueries, please feel free to ask.