RemoveAt

StructuredDocumentTagCollection.RemoveAt method

Removes a structured document tag at the specified index.

public void RemoveAt(int index)
ParameterTypeDescription
indexInt32An index into the collection.

Examples

Shows how to remove structured document tag.

Document doc = new Document(MyDir + "Structured document tags.docx");

StructuredDocumentTagCollection structuredDocumentTags = doc.Range.StructuredDocumentTags;
IStructuredDocumentTag sdt;
for (int i = 0; i < structuredDocumentTags.Count; i++)
{
    sdt = structuredDocumentTags[i];
    Console.WriteLine(sdt.Title);
}

sdt = structuredDocumentTags.GetById(1691867797);
Assert.That(sdt.Id, Is.EqualTo(1691867797));

Assert.That(structuredDocumentTags.Count, Is.EqualTo(5));
// Remove the structured document tag by Id.
structuredDocumentTags.Remove(1691867797);
// Remove the structured document tag at position 0.
structuredDocumentTags.RemoveAt(0);
Assert.That(structuredDocumentTags.Count, Is.EqualTo(3));

See Also