Package org.apache.poi.hslf.record

Examples of org.apache.poi.hslf.record.Environment


     * Check we can read their attributes.
     */
    public void testSlideMaster() throws Exception {
        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));

        Environment env = ppt.getDocumentRecord().getEnvironment();

        SlideMaster[] master = ppt.getSlidesMasters();
        assertEquals(2, master.length);

        //character attributes
        assertEquals(40, master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());
        assertEquals(48, master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());

        int font1 = master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        int font2 = master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        assertEquals("Arial", env.getFontCollection().getFontWithId(font1));
        assertEquals("Georgia", env.getFontCollection().getFontWithId(font2));

        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        //now paragraph attributes
        assertEquals(0x266B, master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
        assertEquals(0x2022, master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());

        int b1 = master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
        int b2 = master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
        assertEquals("Arial", env.getFontCollection().getFontWithId(b1));
        assertEquals("Georgia", env.getFontCollection().getFontWithId(b2));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.record.Environment

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.