Package org.apache.poi.xssf.model
Class CommentsTable
- java.lang.Object
-
- org.apache.poi.ooxml.POIXMLDocumentPart
-
- org.apache.poi.xssf.model.CommentsTable
-
- All Implemented Interfaces:
Comments
@Internal public class CommentsTable extends POIXMLDocumentPart implements Comments
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_AUTHORstatic intDEFAULT_AUTHOR_ID
-
Constructor Summary
Constructors Constructor Description CommentsTable()CommentsTable(PackagePart part)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intfindAuthor(java.lang.String author)XSSFCommentfindCellComment(CellAddress cellAddress)Finds the cell comment at cellAddress, if one existsjava.lang.StringgetAuthor(long authorId)java.util.Iterator<CellAddress>getCellAddresses()Returns all cell addresses that have comments.java.util.Map<CellAddress,XSSFComment>getCellComments()Deprecated.usegetCellAddressesinsteadCTCommentgetCTComment(CellAddress cellRef)Get the underlying CTComment xmlbean for a comment located at cellRef, if it existsCTCommentsgetCTComments()Returns the underlying CTComments list xmlbeanintgetNumberOfAuthors()intgetNumberOfComments()CTCommentnewComment(CellAddress ref)Create a new comment located` at cell addressvoidreadFrom(java.io.InputStream is)voidreferenceUpdated(CellAddress oldReference, CTComment comment)Called after the reference is updated, so that we can reflect that in our cachebooleanremoveComment(CellAddress cellRef)Remove the comment at cellRef location, if one existsvoidwriteTo(java.io.OutputStream out)-
Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommited, setCommited, toString
-
-
-
-
Field Detail
-
DEFAULT_AUTHOR
public static final java.lang.String DEFAULT_AUTHOR
- See Also:
- Constant Field Values
-
DEFAULT_AUTHOR_ID
public static final int DEFAULT_AUTHOR_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommentsTable
public CommentsTable()
-
CommentsTable
public CommentsTable(PackagePart part) throws java.io.IOException
- Throws:
java.io.IOException- Since:
- POI 3.14-Beta1
-
-
Method Detail
-
readFrom
public void readFrom(java.io.InputStream is) throws java.io.IOException- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
referenceUpdated
public void referenceUpdated(CellAddress oldReference, CTComment comment)
Called after the reference is updated, so that we can reflect that in our cache- Parameters:
oldReference- the comment to remove from the commentRefs mapcomment- the comment to replace in the commentRefs map
-
getNumberOfComments
public int getNumberOfComments()
- Specified by:
getNumberOfCommentsin interfaceComments
-
getNumberOfAuthors
public int getNumberOfAuthors()
- Specified by:
getNumberOfAuthorsin interfaceComments
-
getAuthor
public java.lang.String getAuthor(long authorId)
-
findAuthor
public int findAuthor(java.lang.String author)
- Specified by:
findAuthorin interfaceComments
-
findCellComment
public XSSFComment findCellComment(CellAddress cellAddress)
Finds the cell comment at cellAddress, if one exists- Specified by:
findCellCommentin interfaceComments- Parameters:
cellAddress- the address of the cell to find a comment- Returns:
- cell comment if one exists, otherwise returns null
-
getCTComment
@Internal public CTComment getCTComment(CellAddress cellRef)
Get the underlying CTComment xmlbean for a comment located at cellRef, if it exists- Parameters:
cellRef- the location of the cell comment- Returns:
- CTComment xmlbean if comment exists, otherwise return null.
-
getCellAddresses
public java.util.Iterator<CellAddress> getCellAddresses()
Returns all cell addresses that have comments.- Specified by:
getCellAddressesin interfaceComments- Returns:
- An iterator to traverse all cell addresses that have comments.
- Since:
- 4.0.0
-
getCellComments
@Removal(version="4.2") @Deprecated public java.util.Map<CellAddress,XSSFComment> getCellComments()
Deprecated.usegetCellAddressesinsteadReturns all cell comments on this sheet.- Returns:
- A map of each Comment in this sheet, keyed on the cell address where the comment is located.
-
newComment
@Internal public CTComment newComment(CellAddress ref)
Create a new comment located` at cell address- Parameters:
ref- the location to add the comment- Returns:
- a new CTComment located at ref with default author
-
removeComment
public boolean removeComment(CellAddress cellRef)
Remove the comment at cellRef location, if one exists- Specified by:
removeCommentin interfaceComments- Parameters:
cellRef- the location of the comment to remove- Returns:
- returns true if a comment was removed
-
getCTComments
@Internal public CTComments getCTComments()
Returns the underlying CTComments list xmlbean- Returns:
- underlying comments list xmlbean
-
-