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.String
DEFAULT_AUTHOR
static int
DEFAULT_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 void
commentUpdated(XSSFComment comment)
Called after the comment is updated, so that we can reflect that in our cacheXSSFComment
createNewComment(ClientAnchor clientAnchor)
Create a new comment and add to the CommentTable.int
findAuthor(java.lang.String author)
XSSFComment
findCellComment(CellAddress cellAddress)
Finds the cell comment at cellAddress, if one existsjava.lang.String
getAuthor(long authorId)
java.util.Iterator<CellAddress>
getCellAddresses()
Returns all cell addresses that have comments.CTComments
getCTComments()
Returns the underlying CTComments list xmlbeanint
getNumberOfAuthors()
int
getNumberOfComments()
CTComment
newComment(CellAddress ref)
Create a new comment located at cell addressvoid
readFrom(java.io.InputStream is)
void
referenceUpdated(CellAddress oldReference, XSSFComment comment)
Called after the reference is updated, so that we can reflect that in our cachevoid
referenceUpdated(CellAddress oldReference, CTComment comment)
Deprecated.boolean
removeComment(CellAddress cellRef)
Remove the comment at cellRef location, if one existsvoid
setSheet(Sheet sheet)
This method is for internal POI use only.void
writeTo(java.io.OutputStream out)
-
Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommitted, setCommitted, 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
-
setSheet
@Internal public void setSheet(Sheet sheet)
Description copied from interface:Comments
This method is for internal POI use only. POI uses it to link the sheet and comments table. This method will not move comments from one sheet to another (if a user tries to use this method for that purpose).
-
referenceUpdated
@Deprecated @Removal(version="6.0.0") public void referenceUpdated(CellAddress oldReference, CTComment comment)
Deprecated.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
-
referenceUpdated
public void referenceUpdated(CellAddress oldReference, XSSFComment comment)
Called after the reference is updated, so that we can reflect that in our cache- Specified by:
referenceUpdated
in interfaceComments
- Parameters:
oldReference
- the comment to remove from the commentRefs mapcomment
- the comment to replace in the commentRefs map- Since:
- POI 5.2.0
- See Also:
commentUpdated(XSSFComment)
-
commentUpdated
public void commentUpdated(XSSFComment comment)
Called after the comment is updated, so that we can reflect that in our cache- Specified by:
commentUpdated
in interfaceComments
- Parameters:
comment
- the comment to replace in the commentRefs map- Since:
- POI 5.2.0
- See Also:
referenceUpdated(CellAddress, XSSFComment)
-
getNumberOfComments
public int getNumberOfComments()
- Specified by:
getNumberOfComments
in interfaceComments
-
getNumberOfAuthors
public int getNumberOfAuthors()
- Specified by:
getNumberOfAuthors
in interfaceComments
-
getAuthor
public java.lang.String getAuthor(long authorId)
-
findAuthor
public int findAuthor(java.lang.String author)
- Specified by:
findAuthor
in interfaceComments
-
findCellComment
public XSSFComment findCellComment(CellAddress cellAddress)
Finds the cell comment at cellAddress, if one exists- Specified by:
findCellComment
in interfaceComments
- Parameters:
cellAddress
- the address of the cell to find a comment- Returns:
- cell comment if one exists, otherwise returns null
-
getCellAddresses
public java.util.Iterator<CellAddress> getCellAddresses()
Returns all cell addresses that have comments.- Specified by:
getCellAddresses
in interfaceComments
- Returns:
- An iterator to traverse all cell addresses that have comments.
- Since:
- 4.0.0
-
createNewComment
public XSSFComment createNewComment(ClientAnchor clientAnchor)
Create a new comment and add to the CommentTable.- Specified by:
createNewComment
in interfaceComments
- Parameters:
clientAnchor
- the anchor for this comment- Returns:
- new XSSFComment
- Since:
- POI 5.2.0
-
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:
removeComment
in 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
-
-