Package org.apache.poi.hslf.usermodel

Examples of org.apache.poi.hslf.usermodel.SlideShow


*/
public final class TestSound extends TestCase {
  public void testRealFile() throws Exception {
    String cwd = System.getProperty("HSLF.testdata.path");
    FileInputStream is = new FileInputStream(new File(cwd, "sound.ppt"));
    SlideShow ppt = new SlideShow(is);
    is.close();

    // Get the document
    Document doc = ppt.getDocumentRecord();
        SoundCollection soundCollection = null;
        Record[] doc_ch = doc.getChildRecords();
        for (int i = 0; i < doc_ch.length; i++) {
            if(doc_ch[i] instanceof SoundCollection){
                soundCollection = (SoundCollection)doc_ch[i];
View Full Code Here


*/
public final class TestTxMasterStyleAtom extends TestCase {
    protected SlideShow _ppt;

    public void setUp() throws Exception{
        _ppt = new SlideShow();

    }
View Full Code Here

             } else if ("Document".equals(name)) {
                 HWPFDocument doc = new HWPFDocument(data);
                 num_doc++;
             } else if ("Presentation".equals(name)) {
                 num_ppt++;
                 SlideShow ppt = new SlideShow(data);
             }
         }
         assertEquals("Expected 2 embedded Word Documents", 2, num_doc);
         assertEquals("Expected 2 embedded Excel Spreadsheets", 2, num_xls);
         assertEquals("Expected 2 embedded PowerPoint Presentations", 2, num_ppt);
View Full Code Here

    public void testHeaderFooter() throws Exception {
       String  text;

       // With a header on the notes
       HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("45537_Header.ppt"));
       SlideShow ss = new SlideShow(hslf);
       assertNotNull(ss.getNotesHeadersFooters());
       assertEquals("testdoc test phrase", ss.getNotesHeadersFooters().getHeaderText());

       ppe = new PowerPointExtractor(hslf);

       text = ppe.getText();
       assertFalse("Header shouldn't be there by default\n" + text, text.contains("testdoc"));
       assertFalse("Header shouldn't be there by default\n" + text, text.contains("test phrase"));

       ppe.setNotesByDefault(true);
       text = ppe.getText();
       assertContains(text, "testdoc");
       assertContains(text, "test phrase");


       // And with a footer, also on notes
       hslf = new HSLFSlideShow(slTests.openResourceAsStream("45537_Footer.ppt"));
       ss = new SlideShow(hslf);
       assertNotNull(ss.getNotesHeadersFooters());
       assertEquals("testdoc test phrase", ss.getNotesHeadersFooters().getFooterText());

       ppe = new PowerPointExtractor(slTests.openResourceAsStream("45537_Footer.ppt"));

       text = ppe.getText();
       assertFalse("Header shouldn't be there by default\n" + text, text.contains("testdoc"));
View Full Code Here

     * @param run  <code>TextRun</code> to lookup hyperlinks in
     * @return found hyperlinks or <code>null</code> if not found
     */
    protected static Hyperlink[] find(TextRun run){
        ArrayList lst = new ArrayList();
        SlideShow ppt = run.getSheet().getSlideShow();
        //document-level container which stores info about all links in a presentation
        ExObjList exobj = ppt.getDocumentRecord().getExObjList();
        if (exobj == null) {
            return null;
        }
        Record[] records = run._records;
        if(records != null) find(records, exobj, lst);
View Full Code Here

     * @param shape  <code>Shape</code> to lookup hyperlink in
     * @return found hyperlink or <code>null</code>
     */
    protected static Hyperlink find(Shape shape){
        ArrayList lst = new ArrayList();
        SlideShow ppt = shape.getSheet().getSlideShow();
        //document-level container which stores info about all links in a presentation
        ExObjList exobj = ppt.getDocumentRecord().getExObjList();
        if (exobj == null) {
            return null;
        }

        EscherContainerRecord spContainer = shape.getSpContainer();
View Full Code Here

      // We need to identify and fix that first
      //assertSlideShowWritesOutTheSame(hssB, pfsB);
    }
    public void assertSlideShowWritesOutTheSame(HSLFSlideShow hss, POIFSFileSystem pfs) throws Exception {
      // Create a slideshow covering it
      SlideShow ss = new SlideShow(hss);
      ss.getSlides();
      ss.getNotes();

    // Now write out to a byte array
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    hss.write(baos);
View Full Code Here

      assertEquals(_oData[i], _nData[i]);
    }
  }
   
    public void test48593() throws Exception {
    SlideShow slideShow = new SlideShow();
    slideShow.createSlide();
    slideShow = HSLFTestDataSamples.writeOutAndReadBack(slideShow);
    slideShow.createSlide();
    slideShow = HSLFTestDataSamples.writeOutAndReadBack(slideShow);
    slideShow.createSlide();
    slideShow = HSLFTestDataSamples.writeOutAndReadBack(slideShow);
    slideShow.createSlide();
    slideShow = HSLFTestDataSamples.writeOutAndReadBack(slideShow);
    }
View Full Code Here

  public static SlideShow writeOutAndReadBack(SlideShow original) {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
      original.write(baos);
      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      return new SlideShow(bais);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

   * @param ss the HSLFSlideShow to extract text from
   */
  public PowerPointExtractor(HSLFSlideShow ss) {
    super(ss);
    _hslfshow = ss;
    _show = new SlideShow(_hslfshow);
    _slides = _show.getSlides();
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.usermodel.SlideShow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.