Search in sources :

Example 1 with CTBooleanProperty

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty in project poi by apache.

the class XSSFFont method setStrikeout.

/**
     * set a boolean value for the property specifying whether to use a strikeout horizontal line through the text or not
     * If omitted, the default value is true.
     *
     * @param strikeout - value for strikeout or not
     */
public void setStrikeout(boolean strikeout) {
    if (!strikeout)
        _ctFont.setStrikeArray(null);
    else {
        CTBooleanProperty strike = _ctFont.sizeOfStrikeArray() == 0 ? _ctFont.addNewStrike() : _ctFont.getStrikeArray(0);
        strike.setVal(strikeout);
    }
}
Also used : CTBooleanProperty(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty)

Example 2 with CTBooleanProperty

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty in project poi by apache.

the class TestXSSFFont method testItalic.

@Test
public void testItalic() {
    CTFont ctFont = CTFont.Factory.newInstance();
    CTBooleanProperty bool = ctFont.addNewI();
    bool.setVal(false);
    ctFont.setIArray(0, bool);
    XSSFFont xssfFont = new XSSFFont(ctFont);
    assertEquals(false, xssfFont.getItalic());
    xssfFont.setItalic(true);
    assertEquals(ctFont.sizeOfIArray(), 1);
    assertEquals(true, ctFont.getIArray(0).getVal());
    assertEquals(true, ctFont.getIArray(0).getVal());
}
Also used : CTBooleanProperty(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty) CTFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont) Test(org.junit.Test)

Example 3 with CTBooleanProperty

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty in project poi by apache.

the class TestXSSFFont method testBold.

@Test
public void testBold() {
    CTFont ctFont = CTFont.Factory.newInstance();
    CTBooleanProperty bool = ctFont.addNewB();
    bool.setVal(false);
    ctFont.setBArray(0, bool);
    XSSFFont xssfFont = new XSSFFont(ctFont);
    assertEquals(false, xssfFont.getBold());
    xssfFont.setBold(true);
    assertEquals(ctFont.sizeOfBArray(), 1);
    assertEquals(true, ctFont.getBArray(0).getVal());
}
Also used : CTBooleanProperty(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty) CTFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont) Test(org.junit.Test)

Example 4 with CTBooleanProperty

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty in project poi by apache.

the class TestXSSFFont method testStrikeout.

@Test
public void testStrikeout() {
    CTFont ctFont = CTFont.Factory.newInstance();
    CTBooleanProperty bool = ctFont.addNewStrike();
    bool.setVal(false);
    ctFont.setStrikeArray(0, bool);
    XSSFFont xssfFont = new XSSFFont(ctFont);
    assertEquals(false, xssfFont.getStrikeout());
    xssfFont.setStrikeout(true);
    assertEquals(ctFont.sizeOfStrikeArray(), 1);
    assertEquals(true, ctFont.getStrikeArray(0).getVal());
    assertEquals(true, ctFont.getStrikeArray(0).getVal());
}
Also used : CTBooleanProperty(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty) CTFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont) Test(org.junit.Test)

Example 5 with CTBooleanProperty

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty in project poi by apache.

the class XSSFFont method setBold.

/**
     * set a boolean value for the boldness to use. If omitted, the default value is true.
     *
     * @param bold - boldness to use
     */
public void setBold(boolean bold) {
    if (bold) {
        CTBooleanProperty ctBold = _ctFont.sizeOfBArray() == 0 ? _ctFont.addNewB() : _ctFont.getBArray(0);
        ctBold.setVal(bold);
    } else {
        _ctFont.setBArray(null);
    }
}
Also used : CTBooleanProperty(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty)

Aggregations

CTBooleanProperty (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty)6 Test (org.junit.Test)3 CTFont (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont)3