CommentCollection

Inheritance: java.lang.Object, com.aspose.cells.CollectionBase

public class CommentCollection extends CollectionBase

Encapsulates a collection of Comment objects.

Example

         Workbook workbook = new Workbook();
 
         CommentCollection comments = workbook.getWorksheets().get(0).getComments();
 
         //do your business

Methods

MethodDescription
add(int row, int column)Adds a comment to the collection.
add(Object o)Adds an item to the CollectionBase instance.
add(String cellName)Adds a comment to the collection.
addThreadedComment(int row, int column, String text, ThreadedCommentAuthor author)Adds a threaded comment.
addThreadedComment(String cellName, String text, ThreadedCommentAuthor author)Adds a threaded comment.
clear()Removes all comments;
contains(Object o)Return whether instance contains this object
equals(Object arg0)
get(int index)Gets the Comment element at the specified index.
get(int row, int column)Gets the Comment element at the specified row index and column index.
get(String cellName)Gets the Comment element at the specified cell.
getClass()
getCount()Gets the number of elements contained in the CollectionBase instance.
getThreadedComments(int row, int column)Gets the threaded comments by row and column index.
getThreadedComments(String cellName)Gets the threaded comments by cell name.
hashCode()
indexOf(Object o)Determines the index of a specific item in the CollectionBase instance.
iterator()Returns an enumerator that iterates through the CollectionBase instance.
notify()
notifyAll()
removeAt(int index)Removes the item at the specified index.
removeAt(int row, int column)Removes the comment of the specific cell.
removeAt(String cellName)Removes the comment of the specific cell.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

add(int row, int column)

public int add(int row, int column)

Adds a comment to the collection.

Example

         int commentIndex1 = comments.add(0, 0);
         Comment comment1 = comments.get(commentIndex1);
         comment1.setNote("First note.");
         comment1.getFont().setName("Times New Roman");

Parameters:

ParameterTypeDescription
rowintCell row index.
columnintCell column index.

Returns: int - Comment object index.

add(Object o)

public int add(Object o)

Adds an item to the CollectionBase instance.

Parameters:

ParameterTypeDescription
ojava.lang.ObjectThe Object to add to the CollectionBase instance.

Returns: int - The position into which the new element was inserted.

add(String cellName)

public int add(String cellName)

Adds a comment to the collection.

Example

         int commentIndex2 = comments.add("B2");
         Comment comment2 = comments.get(commentIndex2);
         comment2.setNote("Second note.");
         comment2.getFont().setName("Times New Roman");

Parameters:

ParameterTypeDescription
cellNamejava.lang.StringCell name.

Returns: int - Comment object index.

addThreadedComment(int row, int column, String text, ThreadedCommentAuthor author)

public int addThreadedComment(int row, int column, String text, ThreadedCommentAuthor author)

Adds a threaded comment.

Parameters:

ParameterTypeDescription
rowintCell row index.
columnintCell column index.
textjava.lang.StringThe text of the comment
authorThreadedCommentAuthorThe user of this threaded comment.

Returns: int - ThreadedComment object index.

addThreadedComment(String cellName, String text, ThreadedCommentAuthor author)

public int addThreadedComment(String cellName, String text, ThreadedCommentAuthor author)

Adds a threaded comment.

Parameters:

ParameterTypeDescription
cellNamejava.lang.StringThe name of the cell.
textjava.lang.StringThe text of the comment
authorThreadedCommentAuthorThe user of this threaded comment.

Returns: int - ThreadedComment object index.

clear()

public void clear()

Removes all comments;

Example

         comments.clear();

contains(Object o)

public boolean contains(Object o)

Return whether instance contains this object

Parameters:

ParameterTypeDescription
ojava.lang.Objecttest object

Returns: boolean - Whether instance contains this object

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

get(int index)

public Comment get(int index)

Gets the Comment element at the specified index.

Example

         Comment comment3 = comments.get(0);
         comment3.setNote("Three note.");

Parameters:

ParameterTypeDescription
indexintThe zero based index of the element.

Returns: Comment - The element at the specified index.

get(int row, int column)

public Comment get(int row, int column)

Gets the Comment element at the specified row index and column index.

Example

         Comment comment5 = comments.get(1,1);
         comment5.setNote("Five note.");

Parameters:

ParameterTypeDescription
rowintRow index.
columnintColumn index.

Returns: Comment - The element at the specified cell.

get(String cellName)

public Comment get(String cellName)

Gets the Comment element at the specified cell.

Example

         Comment comment4 = comments.get("B2");
         comment4.setNote("Four note.");

Parameters:

ParameterTypeDescription
cellNamejava.lang.StringCell name.

Returns: Comment - The element at the specified cell.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getCount()

public int getCount()

Gets the number of elements contained in the CollectionBase instance.

Returns: int - The number of elements contained in the CollectionBase instance.

getThreadedComments(int row, int column)

public ThreadedCommentCollection getThreadedComments(int row, int column)

Gets the threaded comments by row and column index.

Example

         ThreadedCommentCollection threadedComments1 = comments.getThreadedComments(1, 1);
         for (int i = 0; i <threadedComments1.getCount(); ++i)
         {
             ThreadedComment tc = threadedComments1.get(i);
             String note = tc.getNotes();
         }

Parameters:

ParameterTypeDescription
rowintThe row index.
columnintThe column index.

Returns: ThreadedCommentCollection -

getThreadedComments(String cellName)

public ThreadedCommentCollection getThreadedComments(String cellName)

Gets the threaded comments by cell name.

Example

         ThreadedCommentCollection threadedComments2 = comments.getThreadedComments("B2");
         for (int i = 0; i <threadedComments2.getCount(); ++i)
         {
             ThreadedComment tc = threadedComments2.get(i);
             String note = tc.getNotes();
         }

Parameters:

ParameterTypeDescription
cellNamejava.lang.StringThe name of the cell.

Returns: ThreadedCommentCollection -

hashCode()

public native int hashCode()

Returns: int

indexOf(Object o)

public int indexOf(Object o)

Determines the index of a specific item in the CollectionBase instance.

Parameters:

ParameterTypeDescription
ojava.lang.ObjectDetermines the index of a specific item in the CollectionBase instance.

Returns: int - The index of value if found in the list; otherwise, -1.

iterator()

public Iterator iterator()

Returns an enumerator that iterates through the CollectionBase instance.

Returns: java.util.Iterator - An iterator for the CollectionBase instance.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

removeAt(int index)

public void removeAt(int index)

Removes the item at the specified index.

Parameters:

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

removeAt(int row, int column)

public void removeAt(int row, int column)

Removes the comment of the specific cell.

Example

         comments.removeAt(1,1);

Parameters:

ParameterTypeDescription
rowintThe row index.
columnintthe column index.

removeAt(String cellName)

public void removeAt(String cellName)

Removes the comment of the specific cell.

Example

         comments.removeAt("B2");

Parameters:

ParameterTypeDescription
cellNamejava.lang.StringThe name of cell which contains a comment.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int