Search in sources :

Example 1 with HSLFMasterSheet

use of org.apache.poi.hslf.usermodel.HSLFMasterSheet in project poi by apache.

the class TestSlideMaster method testTitleMaster.

/**
     * Slide 3 has title layout and follows the TitleMaster. Verify that.
     */
@Test
public void testTitleMaster() throws IOException {
    HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
    HSLFSlide slide = ppt.getSlides().get(2);
    HSLFMasterSheet masterSheet = slide.getMasterSheet();
    assertTrue(masterSheet instanceof HSLFTitleMaster);
    for (List<HSLFTextParagraph> txt : slide.getTextParagraphs()) {
        HSLFTextRun rt = txt.get(0).getTextRuns().get(0);
        switch(txt.get(0).getRunType()) {
            case TextHeaderAtom.CENTER_TITLE_TYPE:
                assertEquals("Arial", rt.getFontFamily());
                assertEquals(32, rt.getFontSize(), 0);
                assertEquals(true, rt.isBold());
                assertEquals(true, rt.isUnderlined());
                break;
            case TextHeaderAtom.CENTRE_BODY_TYPE:
                assertEquals("Courier New", rt.getFontFamily());
                assertEquals(20, rt.getFontSize(), 0);
                assertEquals(true, rt.isBold());
                assertEquals(false, rt.isUnderlined());
                break;
        }
    }
    ppt.close();
}
Also used : HSLFTextRun(org.apache.poi.hslf.usermodel.HSLFTextRun) HSLFMasterSheet(org.apache.poi.hslf.usermodel.HSLFMasterSheet) HSLFTextParagraph(org.apache.poi.hslf.usermodel.HSLFTextParagraph) HSLFSlideShow(org.apache.poi.hslf.usermodel.HSLFSlideShow) HSLFSlide(org.apache.poi.hslf.usermodel.HSLFSlide) HSLFTitleMaster(org.apache.poi.hslf.usermodel.HSLFTitleMaster) Test(org.junit.Test)

Aggregations

HSLFMasterSheet (org.apache.poi.hslf.usermodel.HSLFMasterSheet)1 HSLFSlide (org.apache.poi.hslf.usermodel.HSLFSlide)1 HSLFSlideShow (org.apache.poi.hslf.usermodel.HSLFSlideShow)1 HSLFTextParagraph (org.apache.poi.hslf.usermodel.HSLFTextParagraph)1 HSLFTextRun (org.apache.poi.hslf.usermodel.HSLFTextRun)1 HSLFTitleMaster (org.apache.poi.hslf.usermodel.HSLFTitleMaster)1 Test (org.junit.Test)1