Aspose::Words::WebExtensions::BaseWebExtensionCollection<T> class
Contents
[
Hide
]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>
| Parameter | Description |
|---|---|
| T | Type of a collection item. |
Methods
| Method | Description |
|---|---|
| Add(T) | Adds specified item to the collection. |
| Clear() | Removes all elements from the collection. |
| GetEnumerator() | Returns an enumerator that can iterate through a collection. |
| Remove(int32_t) | Removes the item at the specified index from the collection. |
| get_Count() | Gets the number of elements contained in the 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. |
Typedefs
| Typedef | Description |
|---|---|
| const_iterator | Const iterator type. |
| iterator | Iterator type. |
| iterator_holder_type | A collection type whose iterator types is used as iterator types in the current collection. |
| virtualized_iterator | Virtualized type. |
| virtualized_iterator_element | Virtualized element type. |
Examples
Shows how to work with a document’s collection of web extensions.
auto doc = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"Web extension.docx"));
ASSERT_EQ(doc->get_WebExtensionTaskPanes()->get_Count(), 1);
// Print all properties of the document's web extension.
System::SharedPtr<Aspose::Words::WebExtensions::WebExtensionPropertyCollection> webExtensionPropertyCollection = doc->get_WebExtensionTaskPanes()->idx_get(0)->get_WebExtension()->get_Properties();
{
System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Words::WebExtensions::WebExtensionProperty>>> enumerator = webExtensionPropertyCollection->GetEnumerator();
while (enumerator->MoveNext())
{
System::SharedPtr<Aspose::Words::WebExtensions::WebExtensionProperty> webExtensionProperty = enumerator->get_Current();
std::cout << System::String::Format(u"Binding name: {0}; Binding value: {1}", webExtensionProperty->get_Name(), webExtensionProperty->get_Value()) << std::endl;
}
}
// Remove the web extension.
doc->get_WebExtensionTaskPanes()->Remove(0);
ASSERT_EQ(doc->get_WebExtensionTaskPanes()->get_Count(), 0);
See Also
- Namespace Aspose::Words::WebExtensions
- Library Aspose.Words for C++