Let it be said that tables s*%k hard!
Well, it's ok now I've worked them out (for my needs anyhow) but what an effort! There is very little info on the implementation of these things with code.
Anyway, for those interested here's what works for me.
Table mTable = tr.GetObject(entRes.ObjectId,OpenMode.ForWrite)as Table;
int j = 1;
string item = "n/a";
foreach(DataRow dr in dt.Rows)
{
if(dr["itemno"].ToString() == "tbc")
{
item = j.ToString();
j++;
}
else
{
item = dr["itemno"].ToString();
}
mTable.InsertRows(2,1.0,1);
ed.WriteMessage("\n" + item + " " + dr["qty"]);
mTable.SetTextString(2, 0, item );
mTable.SetTextString(2, 1, dr["qty"].ToString());
mTable.SetTextString(2, 2, dr["material"].ToString());
mTable.SetTextString(2, 3, dr["length"].ToString());
mTable.SetTextString(2, 4, dr["mass"].ToString());
}
Note I have a title and header rows in my table style. And the output -