Package org.apache.poi.hslf

Examples of org.apache.poi.hslf.HSLFSlideShow


   */
  public PowerPointExtractor(POIFSFileSystem fs) throws IOException {
    this(new HSLFSlideShow(fs));
  }
  public PowerPointExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
    this(new HSLFSlideShow(dir, fs));
  }
View Full Code Here


    public TestDocument() throws Exception {
    String dirname = System.getProperty("HSLF.testdata.path");
    String filename = dirname + "/basic_test_ppt_file.ppt";
    FileInputStream fis = new FileInputStream(filename);
    pfs = new POIFSFileSystem(fis);
    ss = new HSLFSlideShow(pfs);
    }
View Full Code Here

    super.setUp();

    // Find a real RecordContainer record
    String dirname = System.getProperty("HSLF.testdata.path");
    String filename = dirname + "/basic_test_ppt_file.ppt";
    HSLFSlideShow hss = new HSLFSlideShow(filename);

    Record[] r = hss.getRecords();
    for(int i=0; i<r.length; i++) {
      if(r[i] instanceof RecordContainer) {
        recordContainer = (RecordContainer)r[i];
        return;
      }
View Full Code Here

   
    public void testExtractFromEmbeded() throws Exception {
         POIFSFileSystem fs = new POIFSFileSystem(
             POIDataSamples.getSpreadSheetInstance().openResourceAsStream("excel_with_embeded.xls")
         );
         HSLFSlideShow ss;

         DirectoryNode dirA = (DirectoryNode)
             fs.getRoot().getEntry("MBD0000A3B6");
         DirectoryNode dirB = (DirectoryNode)
             fs.getRoot().getEntry("MBD0000A3B3");

         assertNotNull(dirA.getEntry("PowerPoint Document"));
         assertNotNull(dirB.getEntry("PowerPoint Document"));

         // Check the first file
         ss = new HSLFSlideShow(dirA);
         ppe = new PowerPointExtractor(ss);
         assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
                 ppe.getText(true, false)
         );

         // And the second
         ss = new HSLFSlideShow(dirB);
         ppe = new PowerPointExtractor(ss);
         assertEquals("Sample PowerPoint file\nThis is the 2nd file\nNot much too it either\n",
                 ppe.getText(true, false)
         );
     }
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"));
View Full Code Here

   
   public void testSlideMasterText() throws Exception {
      String masterTitleText = "This is the Master Title";
      String masterRandomText = "This text comes from the Master Slide";
      String masterFooterText = "Footer from the master slide";
      HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("WithMaster.ppt"));
     
      ppe = new PowerPointExtractor(hslf);
     
      String text = ppe.getText();
      //assertContains(text, masterTitleText); // TODO Is this available in PPT?
View Full Code Here

       assertFalse(text.contains("Click to edit Master"));
      
       // Now with another file only containing master text
       // Will always show up
       String masterText = "Footer from the master slide";
       HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("WithMaster.ppt"));
      
       ppe = new PowerPointExtractor(hslf);
      
       text = ppe.getText();
       assertContains(text.toLowerCase(), "master");
View Full Code Here

          assertEquals(expectText, extractor.getText());
       }

       // Open via a HWPFDocument
       for(DirectoryNode dir : files) {
          HSLFSlideShow slideshow = new HSLFSlideShow(dir);
          PowerPointExtractor extractor = new PowerPointExtractor(slideshow);
          assertEquals(expectText, extractor.getText());
       }
    }
View Full Code Here

   private HSLFSlideShow hssChinese;
   private static String filenameC;

   protected void setUp() throws Exception {
      // Basic (non rich) test file
      hss = new HSLFSlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
      ss = new SlideShow(hss);

    // Rich test file A
    hssRichA = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
    ssRichA = new SlideShow(hssRichA);

    // Rich test file B
    hssRichB = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page_With_Fonts_and_Alignments.ppt"));
    ssRichB = new SlideShow(hssRichB);

    // Rich test file C - has paragraph styles that run out before
    //   the character ones do
    filenameC = "ParagraphStylesShorterThanCharStyles.ppt";
        hssRichC = new HSLFSlideShow(_slTests.openResourceAsStream(filenameC));
    ssRichC = new SlideShow(hssRichC);
   
    // Rich test file with Chinese + English text in it
      hssChinese = new HSLFSlideShow(_slTests.openResourceAsStream("54880_chinese.ppt"));
      ssChinese = new SlideShow(hssChinese);
  }
View Full Code Here

      // Write out and back in
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      h[i].write(baos);
      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());

      HSLFSlideShow readHSLF = new HSLFSlideShow(bais);
      SlideShow readS = new SlideShow(readHSLF);

      // Tweak existing one again, to ensure really worked
      rtr.setBold(false);
      rtr.setFontSize(17);
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.HSLFSlideShow

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.