TagCollection

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.slides.ITagCollection

public final class TagCollection implements ITagCollection

Represents the collection of tags (user defined pairs of strings)


The following example shows how to add a tag to a PowerPoint Presentation.
 
 Presentation pres = new Presentation("pres.pptx");
 try {
     ITagCollection tags = pres.getCustomData().getTags();
     pres.getCustomData().getTags().add("MyTag", "My Tag Value");
 } finally {
     if (pres != null) pres.dispose();
 }

Methods

MethodDescription
size()Returns a number of tags in the collectoin.
add(String name, String value)Adds a new tag to collection.
remove(String name)Removes the tag with a specified name from the collection.
indexOfName(String name)Returns the zero-based index of the specified key in the collection.
contains(String name)Determines whether the collection contains a specific name.
removeAt(int index)Removes the tag at the specified index.
clear()Removes all tags from the collection.
getValueByIndex(int index)Returns value of a tag at the specified index.
getNameByIndex(int index)Returns key of a tag at the specified index.
getNamesOfTags()Returns names of tags.
get_Item(String name)Returns or sets a key and a value pair of a tag.
set_Item(String name, String value)Returns or sets a key and a value pair of a tag.
copyTo(System.Array array, int index)Copies all elements from the collection into the specified array.
isSynchronized()Returns a value indicating whether access to the collection is synchronized (thread-safe).
getSyncRoot()Returns a synchronization root.
iterator()Returns an enumerator that iterates through the collection.
iteratorJava()Returns a java iterator for the entire collection.

size()

public final int size()

Returns a number of tags in the collectoin. Read-only int.

Returns: int

add(String name, String value)

public final int add(String name, String value)

Adds a new tag to collection.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the tag.
valuejava.lang.StringThe value of the tag.

Returns: int - The index of the added tag.

remove(String name)

public final void remove(String name)

Removes the tag with a specified name from the collection.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of tag to remove.

indexOfName(String name)

public final int indexOfName(String name)

Returns the zero-based index of the specified key in the collection.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name to locate in the collection.

Returns: int - The zero-based index of key, if key is found in the collection; otherwise, -1.

contains(String name)

public final boolean contains(String name)

Determines whether the collection contains a specific name.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe key to locate.

Returns: boolean - True if the collection contains an tag with the specified key; otherwise, false.

removeAt(int index)

public final void removeAt(int index)

Removes the tag at the specified index.

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the tag to remove.

clear()

public final void clear()

Removes all tags from the collection.

getValueByIndex(int index)

public final String getValueByIndex(int index)

Returns value of a tag at the specified index.

Parameters:

ParameterTypeDescription
indexintIndex of a tag to return.

Returns: java.lang.String - Value of a tag.

getNameByIndex(int index)

public final String getNameByIndex(int index)

Returns key of a tag at the specified index.

Parameters:

ParameterTypeDescription
indexintIndex of a tag to return.

Returns: java.lang.String - Key of a tag.

getNamesOfTags()

public final String[] getNamesOfTags()

Returns names of tags.

Returns: java.lang.String[] - Names of tags.

get_Item(String name)

public final String get_Item(String name)

Returns or sets a key and a value pair of a tag.

Parameters:

ParameterTypeDescription
namejava.lang.StringKey of a tag.

Returns: java.lang.String - Value of a tag.

set_Item(String name, String value)

public final void set_Item(String name, String value)

Returns or sets a key and a value pair of a tag.

Parameters:

ParameterTypeDescription
namejava.lang.StringKey of a tag.
valuejava.lang.String

copyTo(System.Array array, int index)

public final void copyTo(System.Array array, int index)

Copies all elements from the collection into the specified array.

Parameters:

ParameterTypeDescription
arraycom.aspose.ms.System.ArrayArray to fill.
indexintStarting position in target array.

isSynchronized()

public final boolean isSynchronized()

Returns a value indicating whether access to the collection is synchronized (thread-safe). Read-only boolean.

Returns: boolean

getSyncRoot()

public final Object getSyncRoot()

Returns a synchronization root. Read-only Object.

Returns: java.lang.Object

iterator()

public final System.Collections.Generic.IGenericEnumerator<System.Collections.Generic.KeyValuePair<String,String>> iterator()

Returns an enumerator that iterates through the collection.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.ms.System.Collections.Generic.KeyValuePair<java.lang.String,java.lang.String» - A IGenericEnumerator that can be used to iterate through the collection.

iteratorJava()

public final System.Collections.Generic.IGenericEnumerator<System.Collections.Generic.KeyValuePair<String,String>> iteratorJava()

Returns a java iterator for the entire collection.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.ms.System.Collections.Generic.KeyValuePair<java.lang.String,java.lang.String» - An java.util.Iterator for the entire collection.