Examples of SlideShow


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

            try {
                FileInputStream is = new FileInputStream(files[i]);
                HSLFSlideShow hslf = new HSLFSlideShow(is);
                is.close();

                SlideShow ppt = new SlideShow(hslf);
                doSlideShow(ppt);
            } catch (EncryptedPowerPointFileException e){
                ; //skip encrypted ppt
            }
        }
View Full Code Here

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

    String dirname = System.getProperty("HSLF.testdata.path");
    String filename = dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
    FileInputStream fis = new FileInputStream(filename);
    pfs = new POIFSFileSystem(fis);
    hss = new HSLFSlideShow(pfs);
    ss = new SlideShow(hss);
    }
View Full Code Here

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

    private SlideShow pptB;

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

    String filenameB = dirname + "/empty_textbox.ppt";
    pptB = new SlideShow(new HSLFSlideShow(filenameB));
    }
View Full Code Here

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

        ppt.write(out);
        out.close();

        //read ppt from byte array

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
        assertEquals(1, ppt.getSlides().length);

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

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

     * @throws Exception
     */
    public void testTextBoxRead() throws Exception {
        String dirname = System.getProperty("HSLF.testdata.path");
        String filename = dirname + "/with_textbox.ppt";
        ppt = new SlideShow(new HSLFSlideShow(filename));
        Slide sl = ppt.getSlides()[0];
        Shape[] sh = sl.getShapes();
        for (int i = 0; i < sh.length; i++) {
            assertTrue(sh[i] instanceof TextBox);
            TextBox txtbox = (TextBox)sh[i];
View Full Code Here

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

    /**
     * Verify that we can add TextBox shapes to a slide
     * and set some of the style attributes
     */
    public void testTextBoxWriteBytes() throws Exception {
        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.setFontName("Arial");
        rt.setFontSize(42);
        rt.setBold(true);
        rt.setItalic(true);
        rt.setUnderlined(false);
        rt.setFontColor(Color.red);
        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());
        assertFalse(rt.isUnderlined());
        assertEquals("Arial", rt.getFontName());
        assertEquals(Color.red, rt.getFontColor());

        // 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.usermodel.SlideShow

        textBoxSet("/incorrect_slide_order.ppt");
    }

    private void textBoxSet(String filename) throws Exception {
        String dirname = System.getProperty("HSLF.testdata.path");
        SlideShow ppt = new SlideShow(new HSLFSlideShow(dirname + filename));
        Slide[] sl = ppt.getSlides();
        for (int k = 0; k < sl.length; k++) {
            ArrayList lst1 = new ArrayList();
            TextRun[] txt = sl[k].getTextRuns();
            for (int i = 0; i < txt.length; i++) {
                lst1.add(txt[i].getText());
View Full Code Here

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

    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.usermodel.SlideShow

        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.usermodel.SlideShow

* @author Yegor Kozlov
*/
public final class TestPPFont extends TestCase{

    public void testCreate() throws IOException {
        SlideShow ppt = new SlideShow();
        assertEquals(1, ppt.getNumberOfFonts());
        assertEquals("Arial", ppt.getFont(0).getFontName());

        //adding the same font twice
        assertEquals(0, ppt.addFont(PPFont.ARIAL));
        assertEquals(1, ppt.getNumberOfFonts());

        assertEquals(1, ppt.addFont(PPFont.TIMES_NEW_ROMAN));
        assertEquals(2, ppt.addFont(PPFont.COURIER_NEW));
        assertEquals(3, ppt.addFont(PPFont.WINGDINGS));

        assertEquals(4, ppt.getNumberOfFonts());

        assertEquals(PPFont.TIMES_NEW_ROMAN.getFontName(), ppt.getFont(1).getFontName());
        assertEquals(PPFont.COURIER_NEW.getFontName(), ppt.getFont(2).getFontName());

        PPFont font3 = ppt.getFont(3);
        assertEquals(PPFont.WINGDINGS.getFontName(), font3.getFontName());
        assertEquals(PPFont.SYMBOL_CHARSET, font3.getCharSet());
        assertEquals(PPFont.VARIABLE_PITCH, font3.getPitchAndFamily());
    }
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.