return null;
}
+ private CTApplicationNonVisualDrawingProps getCTApplicationNonVisualDrawing() {
+ CTPictureNonVisual nvPicPr = getCTPictureNonVisual();
+ return nvPicPr == null ? null : nvPicPr.getNvPr();
+ }
+
+ /**
+ * @return boolean; true if the picture is an audio
+ */
+ public boolean isAudioFile() {
+ CTApplicationNonVisualDrawingProps nvPr = getCTApplicationNonVisualDrawing();
+ return nvPr != null && nvPr.isSetAudioFile();
+ }
+
+ /**
+ * @return the link ID for the audio file
+ */
+ public String getAudioFileLink() {
+ CTApplicationNonVisualDrawingProps nvPr = getCTApplicationNonVisualDrawing();
+ return nvPr != null && nvPr.isSetAudioFile() ? nvPr.getAudioFile().getLink() : null;
+ }
+
private CTPictureNonVisual getCTPictureNonVisual() {
XmlObject xmlObject = getXmlObject();
if (xmlObject instanceof CTPicture) {
}
return null;
}
-}
\ No newline at end of file
+}
assertEquals(ps.getVideoFileLink(), "rId2");
}
}
+
+ @Test
+ void testIsSetAudioFile() throws IOException {
+ try (XMLSlideShow ppt = openSampleDocument("EmbeddedAudio.pptx")) {
+ XSLFSlide slide = ppt.getSlides().get(0);
+ XSLFPictureShape ps = (XSLFPictureShape) slide.getShapes().get(0);
+
+ assertTrue(ps.isAudioFile());
+ }
+ }
+
+ @Test
+ void testGetAudioLink() throws IOException {
+ try (XMLSlideShow ppt = openSampleDocument("EmbeddedAudio.pptx")) {
+ XSLFSlide slide = ppt.getSlides().get(0);
+ XSLFPictureShape ps = (XSLFPictureShape) slide.getShapes().get(0);
+
+ assertEquals(ps.getAudioFileLink(), "rId2");
+ }
+ }
}
\ No newline at end of file
org/openxmlformats/schemas/drawingml/x2006/main/CTPositiveFixedAngle
org/openxmlformats/schemas/drawingml/x2006/chart/impl/STAxisUnitImpl
org/openxmlformats/schemas/drawingml/x2006/chart/STAxisUnit
+org/openxmlformats/schemas/drawingml/x2006/main/impl/CTAudioFileImpl
+org/openxmlformats/schemas/drawingml/x2006/main/CTAudioFile
stdlblpos1cf4type
staxisunit6cc7type
chartelement2
+ctaudiofile1563type