Examples of HSLFSlideShow


Examples of org.apache.poi.hslf.HSLFSlideShow

        // Serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        sl = ppt.getSlides()[0];

        txtbox = (TextBox)sl.getShapes()[0];
        rt = txtbox.getTextRun().getRichTextRuns()[0];
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

    private SlideShow ppt;

    protected void setUp() throws Exception {
    String dirname = System.getProperty("HSLF.testdata.path");
    String filename = dirname + "/empty.ppt";
    ppt = new SlideShow(new HSLFSlideShow(filename));
    }
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        // And read it back in
        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        assertEquals(1, ppt.getSlides().length);

        slide = ppt.getSlides()[0];
        Shape[] shape = slide.getShapes();
        assertEquals(shape.length, 1); //group shape
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

    /**
     * Add 1 slide to an empty ppt.
     * @throws Exception
     */
    public void testAddSlides1() throws Exception {
        SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
        assertTrue(ppt.getSlides().length == 0);
       
        Slide s1 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 1);
        assertEquals(3, s1._getSheetRefId());
        assertEquals(256, s1._getSheetNumber());
        assertEquals(1, s1.getSlideNumber());

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        assertTrue(ppt.getSlides().length == 1);
    }
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

    /**
     * Add 2 slides to an empty ppt
     * @throws Exception
     */
    public void testAddSlides2() throws Exception {
        SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
        assertTrue(ppt.getSlides().length == 0);
       
        Slide s1 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 1);
        assertEquals(3, s1._getSheetRefId());
        assertEquals(256, s1._getSheetNumber());
        assertEquals(1, s1.getSlideNumber());
       
        Slide s2 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 2);
        assertEquals(4, s2._getSheetRefId());
        assertEquals(257, s2._getSheetNumber());
        assertEquals(2, s2.getSlideNumber());

        //serialize and read again
         ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        assertTrue(ppt.getSlides().length == 2);
    }
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

    /**
     * Add 3 slides to an empty ppt
     * @throws Exception
     */
    public void testAddSlides3() throws Exception {
        SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
        assertTrue(ppt.getSlides().length == 0);
       
        Slide s1 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 1);
        assertEquals(3, s1._getSheetRefId());
        assertEquals(256, s1._getSheetNumber());
        assertEquals(1, s1.getSlideNumber());
       
        Slide s2 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 2);
        assertEquals(4, s2._getSheetRefId());
        assertEquals(257, s2._getSheetNumber());
        assertEquals(2, s2.getSlideNumber());

        Slide s3 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 3);
        assertEquals(5, s3._getSheetRefId());
        assertEquals(258, s3._getSheetNumber());
        assertEquals(3, s3.getSlideNumber());

       
        //serialize and read again
         ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        assertTrue(ppt.getSlides().length == 3);
       
        // Check IDs are still right
        s1 = ppt.getSlides()[0];
        assertEquals(256, s1._getSheetNumber());
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

    /**
     * Add slides to ppt which already has two slides
     */
    public void testAddSlides2to3() throws Exception {
    String dirname = System.getProperty("HSLF.testdata.path");
        SlideShow ppt = new SlideShow(new HSLFSlideShow(dirname + "/basic_test_ppt_file.ppt"));
       
        assertTrue(ppt.getSlides().length == 2);
       
        // First slide is 256 / 4
        Slide s1 = ppt.getSlides()[0];
        assertEquals(256, s1._getSheetNumber());
        assertEquals(4, s1._getSheetRefId());
       
        // Last slide is 257 / 6
        Slide s2 = ppt.getSlides()[1];
        assertEquals(257, s2._getSheetNumber());
        assertEquals(6, s2._getSheetRefId());
       
        // Add another slide, goes in at the end
        Slide s3 = ppt.createSlide();
        assertTrue(ppt.getSlides().length == 3);
        assertEquals(258, s3._getSheetNumber());
        assertEquals(8, s3._getSheetRefId());

       
        // Serialize and read again
         ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        assertTrue(ppt.getSlides().length == 3);
       
       
        // Check IDs are still right
        s1 = ppt.getSlides()[0];
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

    protected void setUp() throws Exception {
    String dirname = System.getProperty("HSLF.testdata.path");
   
    // Basic (non rich) test file
    String filename = dirname + "/basic_test_ppt_file.ppt";
    hss = new HSLFSlideShow(filename);
    ss = new SlideShow(hss);
   
    // Rich test file A
    filename = dirname + "/Single_Coloured_Page.ppt";
    hssRichA = new HSLFSlideShow(filename);
    ssRichA = new SlideShow(hssRichA);
   
    // Rich test file B
    filename = dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
    hssRichB = new HSLFSlideShow(filename);
    ssRichB = new SlideShow(hssRichB);
   
    // Rich test file C - has paragraph styles that run out before
    //   the character ones do
    filenameC = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
    hssRichC = new HSLFSlideShow(filenameC);
    ssRichC = new SlideShow(hssRichC);
  }
View Full Code Here

Examples of org.apache.poi.hslf.HSLFSlideShow

      // 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

Examples of org.apache.poi.hslf.HSLFSlideShow

   *  contents.
   * @param s
   */
  private void assertMatchesSLTWC(SlideShow s) throws Exception {
    // Grab a new copy of slideshow C
    SlideShow refC = new SlideShow(new HSLFSlideShow(filenameC));

    // Write out the 2nd SLWT in the active document
    SlideListWithText refSLWT = refC.getDocumentRecord().getSlideListWithTexts()[1];
    byte[] raw_slwt = writeRecord(refSLWT);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.