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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
commit()
Save the content in the underlying package part.int
findAuthor
(String author) findCellComment
(CellAddress cellAddress) Finds the cell comment at cellAddress, if one existsgetAuthor
(long authorId) Returns all cell addresses that have comments.Deprecated.org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment
getCTComment
(CellAddress cellRef) Get the underlying CTComment xmlbean for a comment located at cellRef, if it existsorg.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments
Returns the underlying CTComments list xmlbeanint
int
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment
newComment
(CellAddress ref) Create a new comment located` at cell addressvoid
readFrom
(InputStream is) void
referenceUpdated
(CellAddress oldReference, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment comment) Called after the reference is updated, so that we can reflect that in our cacheboolean
removeComment
(CellAddress cellRef) Remove the comment at cellRef location, if one existsvoid
writeTo
(OutputStream out) Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommited, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, toString
-
Field Details
-
DEFAULT_AUTHOR
- See Also:
-
DEFAULT_AUTHOR_ID
public static final int DEFAULT_AUTHOR_ID- See Also:
-
-
Constructor Details
-
CommentsTable
public CommentsTable() -
CommentsTable
- Throws:
IOException
- Since:
- POI 3.14-Beta1
-
-
Method Details
-
readFrom
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
commit
Description copied from class:POIXMLDocumentPart
Save the content in the underlying package part. Default implementation is empty meaning that the package part is left unmodified.Sub-classes should override and add logic to marshal the "model" into Ooxml4J.
For example, the code saving a generic XML entry may look as follows:
protected void commit() throws IOException { PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); out.close(); }
- Overrides:
commit
in classPOIXMLDocumentPart
- Throws:
IOException
- a subclass may throw an IOException if the changes can't be committed
-
referenceUpdated
public void referenceUpdated(CellAddress oldReference, org.openxmlformats.schemas.spreadsheetml.x2006.main.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:
getNumberOfComments
in interfaceComments
-
getNumberOfAuthors
public int getNumberOfAuthors()- Specified by:
getNumberOfAuthors
in interfaceComments
-
getAuthor
-
findAuthor
- Specified by:
findAuthor
in interfaceComments
-
findCellComment
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
-
getCTComment
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.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
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
-
getCellComments
Deprecated.usegetCellAddresses
insteadReturns 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 org.openxmlformats.schemas.spreadsheetml.x2006.main.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
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
Returns the underlying CTComments list xmlbean- Returns:
- underlying comments list xmlbean
-
getCellAddresses
instead