public class XWPFComments extends POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
Constructor and Description |
---|
XWPFComments()
Construct XWPFComments from scratch for a new document.
|
XWPFComments(POIXMLDocumentPart parent,
PackagePart part)
Construct XWPFComments from a package part
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addPictureData(byte[] pictureData,
int format)
Adds a picture to the comments.
|
java.lang.String |
addPictureData(byte[] pictureData,
PictureType pictureType)
Adds a picture to the comments.
|
java.lang.String |
addPictureData(java.io.InputStream is,
int format)
Adds a picture to the comments.
|
java.lang.String |
addPictureData(java.io.InputStream is,
PictureType pictureType)
Adds a picture to the comments.
|
protected void |
commit()
save and commit comments
|
XWPFComment |
createComment(java.math.BigInteger cid)
Create a new comment and add it to the document.
|
java.util.List<XWPFPictureData> |
getAllPictures() |
XWPFComment |
getComment(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComment ctComment)
Get the specified comment by ctComment
|
XWPFComment |
getComment(int pos)
Get the specified comment by position
|
XWPFComment |
getCommentByID(java.lang.String id)
Get the specified comment by comment id
|
java.util.List<XWPFComment> |
getComments()
Get the list of
XWPFComment in the Comments part. |
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComments |
getCtComments()
Gets the underlying CTComments object for the comments.
|
XWPFDocument |
getXWPFDocument() |
void |
onDocumentRead()
read comments form an existing package
|
boolean |
removeComment(int pos)
Remove the specified comment if present.
|
void |
setCtComments(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComments ctComments)
set a new comments
|
void |
setXWPFDocument(XWPFDocument document) |
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
public XWPFComments(POIXMLDocumentPart parent, PackagePart part)
part
- the package part holding the data of the footnotes,public XWPFComments()
public void onDocumentRead() throws java.io.IOException
onDocumentRead
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException when a document is readpublic java.lang.String addPictureData(java.io.InputStream is, int format) throws InvalidFormatException, java.io.IOException
is
- The stream to read image fromformat
- The format of the picture, see Document
getAllPictures()
.InvalidFormatException
- If the format of the picture is not known.java.io.IOException
- If reading the picture-data from the stream fails.addPictureData(InputStream, PictureType)
public java.lang.String addPictureData(java.io.InputStream is, PictureType pictureType) throws InvalidFormatException, java.io.IOException
is
- The stream to read image frompictureType
- The PictureType
of the picturegetAllPictures()
.InvalidFormatException
- If the pictureType of the picture is not known.java.io.IOException
- If reading the picture-data from the stream fails.public java.lang.String addPictureData(byte[] pictureData, int format) throws InvalidFormatException
pictureData
- The picture dataformat
- The format of the picture, see Document
getAllPictures()
.InvalidFormatException
- If the format of the picture is not known.public java.lang.String addPictureData(byte[] pictureData, PictureType pictureType) throws InvalidFormatException
pictureData
- The picture datapictureType
- The PictureType
of the picture.getAllPictures()
.InvalidFormatException
- If the pictureType of the picture is not known.protected void commit() throws java.io.IOException
commit
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committedpublic java.util.List<XWPFPictureData> getAllPictures()
public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComments getCtComments()
@Internal public void setCtComments(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComments ctComments)
public java.util.List<XWPFComment> getComments()
XWPFComment
in the Comments part.public XWPFComment getComment(int pos)
pos
- Array position of the commentpublic XWPFComment getCommentByID(java.lang.String id)
id
- comment idpublic XWPFComment getComment(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComment ctComment)
public XWPFComment createComment(java.math.BigInteger cid)
cid
- comment Idpublic boolean removeComment(int pos)
pos
- Array position of the comment to be removedpublic XWPFDocument getXWPFDocument()
public void setXWPFDocument(XWPFDocument document)
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.