Skip to main content
A newer version of this page is available. .

How To: Delete A Table

The following example illustrates how to delete a table cell, row or an entire table.

  • To delete a single cell, use the TableCell.Delete method. The required cell will be deleted and the next one will be moved to the left.
  • The TableRow.Delete method deletes a specified row from the table.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

Table tbl = document.Tables.Create(document.Range.Start, 3, 3, AutoFitBehaviorType.AutoFitToWindow);
tbl.BeginUpdate();
tbl.Rows[2].Delete();
tbl.Cell(1, 1).Delete();

tbl.EndUpdate();
  • To delete the whole table, delete it from the collection of tables contained in the current document. To do that, use the TableCollection.Remove method.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/wpf-richedit-document-api-t213968.

Table tbl = document.Tables.Create(document.Range.Start, 3, 4);
document.Tables.Remove(tbl);