import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.sl.extractor.SlideShowExtractor;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
+import org.apache.poi.xslf.usermodel.XSLFShape;
+import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.xmlbeans.XmlException;
import org.junit.Test;
@Test
public void testGetSimpleText() throws IOException {
try (XMLSlideShow xmlA = openPPTX("sample.pptx");
- SlideShowExtractor extractor = new SlideShowExtractor(xmlA)) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xmlA)) {
extractor.getText();
@Test
public void testGetComments() throws IOException {
try (XMLSlideShow xml = openPPTX("45545_Comment.pptx");
- SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
extractor.setCommentsByDefault(true);
String text = extractor.getText();
@Test
public void testGetMasterText() throws Exception {
try (XMLSlideShow xml = openPPTX("WithMaster.pptx");
- SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
extractor.setSlidesByDefault(true);
extractor.setNotesByDefault(false);
extractor.setMasterByDefault(true);
@Test
public void testTable() throws Exception {
try (XMLSlideShow xml = openPPTX("present1.pptx");
- SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
String text = extractor.getText();
assertTrue(text.length() > 0);
String filename = "testPPT." + extension;
try (XMLSlideShow xml = openPPTX(filename);
- SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
String text = extractor.getText();
if (extension.equals("thmx")) {
@Test
public void bug54570() throws IOException {
try (XMLSlideShow xml = openPPTX("bug54570.pptx");
- SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
String text = extractor.getText();
assertNotNull(text);
}
return new XMLSlideShow(is);
}
}
+
+ @Test
+ public void setSlTests() throws IOException {
+ try (XMLSlideShow xml = openPPTX("aascu.org_hbcu_leadershipsummit_cooper_.pptx")) {
+ SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml);
+ assertNotNull(extractor);
+ extractor.setSlidesByDefault(true);
+ extractor.setNotesByDefault(true);
+ extractor.setMasterByDefault(true);
+
+ assertNotNull(extractor.getText());
+ }
+ }
}