Search in sources :

Example 1 with TableStyle

use of org.apache.poi.ss.usermodel.TableStyle in project poi by apache.

the class TestTableStyles method testBuiltinStyleInit.

/**
     * Test that a built-in style is initialized properly
     */
@Test
public void testBuiltinStyleInit() {
    TableStyle style = XSSFBuiltinTableStyle.TableStyleMedium2.getStyle();
    assertNotNull("no style found for Medium2", style);
    assertNull("Should not have style info for blankRow", style.getStyle(TableStyleType.blankRow));
    DifferentialStyleProvider headerRow = style.getStyle(TableStyleType.headerRow);
    assertNotNull("no header row style", headerRow);
    FontFormatting font = headerRow.getFontFormatting();
    assertNotNull("No header row font formatting", font);
    assertTrue("header row not bold", font.isBold());
    PatternFormatting fill = headerRow.getPatternFormatting();
    assertNotNull("No header fill", fill);
    assertEquals("wrong header fill", 4, ((XSSFColor) fill.getFillBackgroundColorColor()).getTheme());
}
Also used : PatternFormatting(org.apache.poi.ss.usermodel.PatternFormatting) DifferentialStyleProvider(org.apache.poi.ss.usermodel.DifferentialStyleProvider) FontFormatting(org.apache.poi.ss.usermodel.FontFormatting) TableStyle(org.apache.poi.ss.usermodel.TableStyle) Test(org.junit.Test)

Aggregations

DifferentialStyleProvider (org.apache.poi.ss.usermodel.DifferentialStyleProvider)1 FontFormatting (org.apache.poi.ss.usermodel.FontFormatting)1 PatternFormatting (org.apache.poi.ss.usermodel.PatternFormatting)1 TableStyle (org.apache.poi.ss.usermodel.TableStyle)1 Test (org.junit.Test)1