I'm writing a method to delete table rows in AutoCAD based on the value of the first column. My code is:
public void deleteRow(String openingName)
{
Transaction tr = doc.TransactionManager.StartTransaction();
DocumentLock docLock = doc.LockDocument();
using (tr)
using (docLock)
{
if (!IsWriteEnabled || !IsReadEnabled) //Committing transactions closes everything for reading and writing so it must be reopened
{
tr.GetObject(this.ObjectId, OpenMode.ForRead);
tr.GetObject(this.ObjectId, OpenMode.ForWrite);
}
for (int i = 1; i < NumRows; i++)
{
if (Cells[i, 0].GetTextString(FormatOption.ForExpression).Equals(openingName))
{
DeleteRows(i, 1);
}
}
GenerateLayout();
tr.Commit();
}
}
However all it does is delete the values of the cells in the row, leaving an empty row. How do I remove the row itself?