@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 |
---|---|
protected void |
commit()
Save the content in the underlying package part.
(将内容保存在底层包部分中。)
|
int |
findAuthor(java.lang.String author) |
XSSFComment |
findCellComment(CellAddress cellAddress)
Finds the cell comment at cellAddress, if one exists
(在 cellAddress 处查找单元格注释(如果存在))
|
java.lang.String |
getAuthor(long authorId) |
java.util.Iterator<CellAddress> |
getCellAddresses()
Returns all cell addresses that have comments.
(返回所有有注释的单元格地址。)
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment |
getCTComment(CellAddress cellRef)
Get the underlying CTComment xmlbean for a comment located at cellRef, if it exists
(获取位于 cellRef 的评论的底层 CTComment xmlbean(如果存在))
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments |
getCTComments()
Returns the underlying CTComments list xmlbean
(返回底层 CTComments 列表 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)
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
(删除 cellRef 位置的注释(如果存在))
|
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, toString
public 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.IOException
(java.io.IOException)
public void readFrom(java.io.InputStream is) throws java.io.IOException
java.io.IOException
(java.io.IOException)
public void writeTo(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
(java.io.IOException)
protected void commit() throws java.io.IOException
POIXMLDocumentPart
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(); }(将内容保存在底层包部分中。默认实现是空的,这意味着包部分保持不变。子类应覆盖并添加逻辑以将“模型”编组到 Ooxml4J。例如,保存通用 XML 条目的代码可能如下所示: protected void commit() throws IOException { PackagePart part = getPackagePart();输出流输出 = part.getOutputStream(); XmlObject bean = getXmlBean(); //保存内存变化的“模型” bean.save(out, DEFAULT_XML_OPTIONS); out.close(); })
commit
in class
POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committed
(java.io.IOException - 如果无法提交更改,子类可能会抛出 IOException)
public void referenceUpdated(CellAddress oldReference, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment comment)
oldReference
- the comment to remove from the commentRefs map
(oldReference - 要从 commentRefs 映射中删除的评论)
comment
- the comment to replace in the commentRefs map
(comment - 要在 commentRefs 映射中替换的评论)
public int getNumberOfComments()
getNumberOfComments
in interface
Comments
(接口 Comments 中的 getNumberOfComments)
public int getNumberOfAuthors()
getNumberOfAuthors
in interface
Comments
(接口注释中的 getNumberOfAuthors)
public java.lang.String getAuthor(long authorId)
public int findAuthor(java.lang.String author)
findAuthor
in interface
Comments
(接口注释中的 findAuthor)
public XSSFComment findCellComment(CellAddress cellAddress)
findCellComment
in interface
Comments
(接口 Comments 中的 findCellComment)
cellAddress
- the address of the cell to find a comment
(cellAddress - 查找评论的单元格地址)
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment getCTComment(CellAddress cellRef)
cellRef
- the location of the cell comment
(cellRef - 单元格注释的位置)
public java.util.Iterator<CellAddress> getCellAddresses()
getCellAddresses
in interface
Comments
(接口注释中的 getCellAddresses)
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment newComment(CellAddress ref)
ref
- the location to add the comment
(ref - 添加评论的位置)
public boolean removeComment(CellAddress cellRef)
removeComment
in interface
Comments
(接口 Comments 中的 removeComment)
cellRef
- the location of the comment to remove
(cellRef - 要删除的评论的位置)
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments getCTComments()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.