@Internal public class CommentsTable extends POIXMLDocumentPart implements Comments
POIXMLDocumentPart.RelationPart| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_AUTHOR |
static int |
DEFAULT_AUTHOR_ID |
| Constructor and Description |
|---|
CommentsTable() |
CommentsTable(PackagePart part) |
| Modifier and Type | Method and Description |
|---|---|
void |
commentUpdated(XSSFComment comment)
Called after the comment is updated, so that
we can reflect that in our cache
|
protected void |
commit()
Save the content in the underlying package part.
|
XSSFComment |
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 exists
|
java.lang.String |
getAuthor(long authorId) |
java.util.Iterator<CellAddress> |
getCellAddresses()
Returns all cell addresses that have comments.
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments |
getCTComments()
Returns the underlying CTComments list xmlbean
|
int |
getNumberOfAuthors() |
int |
getNumberOfComments() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment |
newComment(CellAddress ref)
Create a new comment located at cell address
|
void |
readFrom(java.io.InputStream is) |
void |
referenceUpdated(CellAddress oldReference,
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment comment)
Deprecated.
|
void |
referenceUpdated(CellAddress oldReference,
XSSFComment comment)
Called after the reference is updated, so that
we can reflect that in our cache
|
boolean |
removeComment(CellAddress cellRef)
Remove the comment at cellRef location, if one exists
|
void |
setSheet(Sheet sheet)
This method is for internal POI use only.
|
void |
writeTo(java.io.OutputStream out) |
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toStringpublic static final java.lang.String DEFAULT_AUTHOR
public static final int DEFAULT_AUTHOR_ID
public CommentsTable()
public CommentsTable(PackagePart part) throws java.io.IOException
java.io.IOExceptionpublic void readFrom(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic void writeTo(java.io.OutputStream out)
throws java.io.IOException
java.io.IOException@Internal public void setSheet(Sheet sheet)
Commentsprotected void commit()
throws java.io.IOException
POIXMLDocumentPartSub-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();
try (OutputStream out = part.getOutputStream()) {
XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
}
}
commit in class POIXMLDocumentPartjava.io.IOException - a subclass may throw an IOException if the changes can't be committed@Deprecated @Removal(version="6.0.0") public void referenceUpdated(CellAddress oldReference, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment comment)
referenceUpdated(CellAddress, XSSFComment)oldReference - the comment to remove from the commentRefs mapcomment - the comment to replace in the commentRefs mappublic void referenceUpdated(CellAddress oldReference, XSSFComment comment)
referenceUpdated in interface CommentsoldReference - the comment to remove from the commentRefs mapcomment - the comment to replace in the commentRefs mapcommentUpdated(XSSFComment)public void commentUpdated(XSSFComment comment)
commentUpdated in interface Commentscomment - the comment to replace in the commentRefs mapreferenceUpdated(CellAddress, XSSFComment)public int getNumberOfComments()
getNumberOfComments in interface Commentspublic int getNumberOfAuthors()
getNumberOfAuthors in interface Commentspublic java.lang.String getAuthor(long authorId)
public int findAuthor(java.lang.String author)
findAuthor in interface Commentspublic XSSFComment findCellComment(CellAddress cellAddress)
findCellComment in interface CommentscellAddress - the address of the cell to find a commentpublic java.util.Iterator<CellAddress> getCellAddresses()
getCellAddresses in interface Commentspublic XSSFComment createNewComment(ClientAnchor clientAnchor)
createNewComment in interface CommentsclientAnchor - the anchor for this comment@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment newComment(CellAddress ref)
ref - the location to add the commentpublic boolean removeComment(CellAddress cellRef)
removeComment in interface CommentscellRef - the location of the comment to remove@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments getCTComments()
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.