Search in sources :

Example 1 with CTFontSize

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

the class TestXSSFFont method testFontHeight.

@Test
public void testFontHeight() {
    CTFont ctFont = CTFont.Factory.newInstance();
    CTFontSize size = ctFont.addNewSz();
    size.setVal(11);
    ctFont.setSzArray(0, size);
    XSSFFont xssfFont = new XSSFFont(ctFont);
    assertEquals(11, xssfFont.getFontHeightInPoints());
    xssfFont.setFontHeight(20);
    assertEquals(20.0, ctFont.getSzArray(0).getVal(), 0.0);
}
Also used : CTFontSize(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize) CTFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont) Test(org.junit.Test)

Example 2 with CTFontSize

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

the class TestXSSFFont method testFontHeightInPoint.

@Test
public void testFontHeightInPoint() {
    CTFont ctFont = CTFont.Factory.newInstance();
    CTFontSize size = ctFont.addNewSz();
    size.setVal(14);
    ctFont.setSzArray(0, size);
    XSSFFont xssfFont = new XSSFFont(ctFont);
    assertEquals(14, xssfFont.getFontHeightInPoints());
    xssfFont.setFontHeightInPoints((short) 20);
    assertEquals(20.0, ctFont.getSzArray(0).getVal(), 0.0);
}
Also used : CTFontSize(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize) CTFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont) Test(org.junit.Test)

Example 3 with CTFontSize

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

the class XSSFFont method setFontHeight.

/**
     * set the font height in points.
     *
     * @param height - height in points
     */
public void setFontHeight(double height) {
    CTFontSize fontSize = _ctFont.sizeOfSzArray() == 0 ? _ctFont.addNewSz() : _ctFont.getSzArray(0);
    fontSize.setVal(height);
}
Also used : CTFontSize(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize)

Aggregations

CTFontSize (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize)3 Test (org.junit.Test)2 CTFont (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont)2