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 |
---|---|
String |
addPictureData(byte[] pictureData,
int format)
Adds a picture to the comments.
|
String |
addPictureData(byte[] pictureData,
PictureType pictureType)
Adds a picture to the comments.
|
String |
addPictureData(InputStream is,
int format)
Adds a picture to the comments.
|
String |
addPictureData(InputStream is,
PictureType pictureType)
Adds a picture to the comments.
|
protected void |
commit()
save and commit comments
|
XWPFComment |
createComment(BigInteger cid)
Create a new comment and add it to the document.
|
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(String id)
Get the specified comment by comment id
|
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, createHyperlink, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getReferenceRelationship, getReferenceRelationships, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeReferenceRelationship, 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 IOException
onDocumentRead
in class POIXMLDocumentPart
IOException
- a subclass may throw an IOException when a document is readpublic String addPictureData(InputStream is, int format) throws InvalidFormatException, 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.IOException
- If reading the picture-data from the stream fails.addPictureData(InputStream, PictureType)
public String addPictureData(InputStream is, PictureType pictureType) throws InvalidFormatException, IOException
is
- The stream to read image frompictureType
- The PictureType
of the picturegetAllPictures()
.InvalidFormatException
- If the pictureType of the picture is not known.IOException
- If reading the picture-data from the stream fails.public 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 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 IOException
commit
in class POIXMLDocumentPart
IOException
- a subclass may throw an IOException if the changes can't be committedpublic 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 List<XWPFComment> getComments()
XWPFComment
in the Comments part.public XWPFComment getComment(int pos)
pos
- Array position of the commentpublic XWPFComment getCommentByID(String id)
id
- comment idpublic XWPFComment getComment(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComment ctComment)
public XWPFComment createComment(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)