Package org.apache.poi.hslf.usermodel

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


    public PictureData getPictureData(){
        EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
        EscherSimpleProperty p = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
        if (p == null) return null;

        SlideShow ppt = shape.getSheet().getSlideShow();
        PictureData[] pict = ppt.getPictureData();
        Document doc = ppt.getDocumentRecord();

        EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
        EscherContainerRecord bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);

        java.util.List lst = bstore.getChildRecords();
View Full Code Here


     * Returns the picture data for this picture.
     *
     * @return the picture data for this picture.
     */
    public PictureData getPictureData(){
        SlideShow ppt = getSheet().getSlideShow();
        PictureData[] pict = ppt.getPictureData();
        Document doc = ppt.getDocumentRecord();
        EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
        EscherContainerRecord bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);

        List lst = bstore.getChildRecords();
        int idx = getPictureIndex()-1;
View Full Code Here

    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
    filename = dirname + "/Single_Coloured_Page.ppt";
    hssRich = new HSLFSlideShow(filename);
    ssRich = new SlideShow(hssRich);
  }
View Full Code Here

   *
   */
  public void testBug41015() throws Exception {
    RichTextRun[] rt;
   
    SlideShow ppt = new SlideShow(new HSLFSlideShow(System.getProperty("HSLF.testdata.path") + "/bug-41015.ppt"));
    Slide sl = ppt.getSlides()[0];
    TextRun[] txt = sl.getTextRuns();
    assertEquals(2, txt.length);
   
    rt = txt[0].getRichTextRuns();
    assertEquals(1, rt.length);
View Full Code Here

    public void testTextBoxWrite() throws Exception {
        //String dirname = System.getProperty("HSLF.testdata.path");
        //String filename = dirname + "/with_textbox.ppt";
        //new SlideShow(new HSLFSlideShow(filename));

        SlideShow ppt = new SlideShow();
        Slide sl = ppt.createSlide();
        RichTextRun rt;

        String val = "Hello, World!";

        // Create a new textbox, and give it lots of properties
        TextBox txtbox = new TextBox();
        rt = txtbox.getTextRun().getRichTextRuns()[0];
        txtbox.setText(val);
        rt.setFontSize(42);
        rt.setBold(true);
        rt.setItalic(true);
        rt.setUnderlined(false);
        sl.addShape(txtbox);

        // Check it before save
        rt = txtbox.getTextRun().getRichTextRuns()[0];
        assertEquals(val, rt.getText());
        assertEquals(42, rt.getFontSize());
        assertTrue(rt.isBold());
        assertTrue(rt.isItalic());

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

        // Check after save
View Full Code Here

    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

        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

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

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

    /**
     * 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());
        assertEquals(3, s1._getSheetRefId());
        s2 = ppt.getSlides()[1];
        assertEquals(257, s2._getSheetNumber());
        assertEquals(4, s2._getSheetRefId());
        s3 = ppt.getSlides()[2];;
        assertTrue(ppt.getSlides().length == 3);
        assertEquals(258, s3._getSheetNumber());
        assertEquals(5, s3._getSheetRefId());
    }
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.