Aspose::Words::Markup::StructuredDocumentTagCollection::RemoveAt method

StructuredDocumentTagCollection::RemoveAt method

Removes a structured document tag at the specified index.

void Aspose::Words::Markup::StructuredDocumentTagCollection::RemoveAt(int32_t index)
ParameterTypeDescription
indexint32_tAn index into the collection.

Examples

Shows how to remove structured document tag.

auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Structured document tags.docx");

System::SharedPtr<Aspose::Words::Markup::StructuredDocumentTagCollection> structuredDocumentTags = doc->get_Range()->get_StructuredDocumentTags();
System::SharedPtr<Aspose::Words::Markup::IStructuredDocumentTag> sdt;
for (int32_t i = 0; i < structuredDocumentTags->get_Count(); i++)
{
    sdt = structuredDocumentTags->idx_get(i);
    std::cout << sdt->get_Title() << std::endl;
}

sdt = structuredDocumentTags->GetById(1691867797);
ASSERT_EQ(1691867797, sdt->get_Id());

ASSERT_EQ(5, structuredDocumentTags->get_Count());
// Remove the structured document tag by Id.
structuredDocumentTags->Remove(1691867797);
// Remove the structured document tag at position 0.
structuredDocumentTags->RemoveAt(0);
ASSERT_EQ(3, structuredDocumentTags->get_Count());

See Also