cool that would be great.
i got it working, im sure there's a better way to do this, but here is the code for anyone else that might be interested
int spanTo = currentRecord.RowSpan;
currentCell.RowSpan = spanTo;
int colToRemove = currentColIndex; // by default we will remove the current column
if (currentColIndex > 0) // if its > 0 we need to check if the cell before this has been spanned
{
int prevColSpan = t.Rows[currentRowIndex].Cells[currentColIndex - 1].ColumnSpan;
if (prevColSpan > 1)
{
colToRemove = currentColIndex + (prevColSpan - 1); // colspan is 1 based index so -1
}
}
while (spanTo > 1) // keep removing columns from rows below the current row
{
int currentRow = currentRowIndex + (spanTo - 1); // span the last row and move backwards
if (t.Rows[currentRow].Cells.Count < colToRemove) // must be spanned or missing columns?
{
colToRemove = t.Rows[currentRow].Cells.Count - 1;
}
t.Rows[currentRow].Cells.RemoveAt(colToRemove);
spanTo -= 1;
}