mirror of https://github.com/apache/poi.git
Import slide notes when importing slide content
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886338 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db962309b9
commit
4cf6b5b071
|
@ -143,7 +143,10 @@ public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> {
|
|||
|
||||
if (this instanceof PlaceableShape) {
|
||||
PlaceableShape<?,?> ps = (PlaceableShape<?,?>)this;
|
||||
ps.setAnchor(sh.getAnchor());
|
||||
Rectangle2D anchor = sh.getAnchor();
|
||||
if (anchor != null) {
|
||||
ps.setAnchor(anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -295,6 +295,11 @@ implements Slide<XSLFShape,XSLFTextParagraph> {
|
|||
return this;
|
||||
}
|
||||
|
||||
XSLFNotes srcNotes = ((XSLFSlide)src).getNotes();
|
||||
if (srcNotes != null) {
|
||||
getSlideShow().getNotesSlide(this).importContent(srcNotes);
|
||||
}
|
||||
|
||||
// only copy direct backgrounds - not backgrounds of master sheet
|
||||
CTBackground bgOther = ((XSLFSlide)src)._slide.getCSld().getBg();
|
||||
if (bgOther == null) {
|
||||
|
|
|
@ -103,4 +103,25 @@ class TestXSLFNotes {
|
|||
|
||||
ppt.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void importNotes() throws IOException {
|
||||
|
||||
XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("sample.pptx");
|
||||
XMLSlideShow newShow = new XMLSlideShow();
|
||||
|
||||
for (XSLFSlide slide : ppt.getSlides()) {
|
||||
XSLFNotes slideNotes = slide.getNotes();
|
||||
assertNotNull(slideNotes);
|
||||
XSLFNotes notesSlide = ppt.getNotesSlide(slide);
|
||||
assertNotNull(notesSlide);
|
||||
assertEquals(notesSlide, slideNotes);
|
||||
|
||||
XSLFSlide newSlide = newShow.createSlide().importContent(slide);
|
||||
XSLFNotes newNotes = newSlide.getNotes();
|
||||
assertNotNull(newNotes);
|
||||
}
|
||||
|
||||
ppt.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue