mirror of https://github.com/apache/poi.git
fixed unable to read comments with pictures
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1890040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6c3e6a4fd
commit
974da9f981
|
@ -56,8 +56,13 @@ public class XWPFComments extends POIXMLDocumentPart {
|
|||
*
|
||||
* @param part the package part holding the data of the footnotes,
|
||||
*/
|
||||
public XWPFComments(PackagePart part) {
|
||||
super(part);
|
||||
public XWPFComments(POIXMLDocumentPart parent, PackagePart part) {
|
||||
super(parent, part);
|
||||
this.document = (XWPFDocument) getParent();
|
||||
|
||||
if (this.document == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
@ -59,4 +60,17 @@ class TestXWPFComments {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testReadComments() throws IOException {
|
||||
try (XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("testComment.docx")) {
|
||||
XWPFComments docComments = doc.getDocComments();
|
||||
assertNotNull(docComments);
|
||||
XWPFComment[] comments = doc.getComments();
|
||||
assertEquals(1, comments.length);
|
||||
|
||||
List<XWPFPictureData> allPictures = docComments.getAllPictures();
|
||||
assertEquals(1, allPictures.size());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue