Aspose::Words::WebExtensions::BaseWebExtensionCollection class

BaseWebExtensionCollection class

Base class for TaskPaneCollection, WebExtensionBindingCollection, WebExtensionPropertyCollection and WebExtensionReferenceCollection collections. To learn more, visit the Work with Office Add-ins documentation article.

template<typename T>class BaseWebExtensionCollection : public System::Collections::Generic::IEnumerable<T>
ParameterDescription
TType of a collection item.

Methods

MethodDescription
Add(T)Adds specified item to the collection.
BaseWebExtensionCollection()
begin()
begin() const
cbegin() const
cend() const
Clear()Removes all elements from the collection.
end()
end() const
get_Count()Gets the number of elements contained in the collection.
GetEnumerator() overrideReturns an enumerator that can iterate through a collection.
idx_get(int32_t)Gets or sets an item at the specified index.
idx_set(int32_t, T)Gets or sets an item at the specified index.
Remove(int32_t)Removes the item at the specified index from the collection.
SetTemplateWeakPtr(uint32_t) override
virtualizeBeginConstIterator() const override
virtualizeBeginIterator() override
virtualizeEndConstIterator() const override
virtualizeEndIterator() override

Typedefs

TypedefDescription
const_iterator
iterator
iterator_holder_type
virtualized_iterator
virtualized_iterator_element

Examples

Shows how to work with a document’s collection of web extensions.

auto doc = MakeObject<Document>(MyDir + u"Web extension.docx");

ASSERT_EQ(1, doc->get_WebExtensionTaskPanes()->get_Count());

// Print all properties of the document's web extension.
SharedPtr<WebExtensionPropertyCollection> webExtensionPropertyCollection =
    doc->get_WebExtensionTaskPanes()->idx_get(0)->get_WebExtension()->get_Properties();
{
    SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<WebExtensionProperty>>> enumerator = webExtensionPropertyCollection->GetEnumerator();
    while (enumerator->MoveNext())
    {
        SharedPtr<WebExtensionProperty> webExtensionProperty = enumerator->get_Current();
        std::cout << "Binding name: " << webExtensionProperty->get_Name() << "; Binding value: " << webExtensionProperty->get_Value() << std::endl;
    }
}

// Remove the web extension.
doc->get_WebExtensionTaskPanes()->Remove(0);

ASSERT_EQ(0, doc->get_WebExtensionTaskPanes()->get_Count());

See Also