use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTVerticalAlignFontProperty in project poi by apache.
the class TestXSSFFont method testTypeOffset.
@Test
public void testTypeOffset() {
CTFont ctFont = CTFont.Factory.newInstance();
CTVerticalAlignFontProperty valign = ctFont.addNewVertAlign();
valign.setVal(STVerticalAlignRun.BASELINE);
ctFont.setVertAlignArray(0, valign);
XSSFFont font = new XSSFFont(ctFont);
assertEquals(Font.SS_NONE, font.getTypeOffset());
font.setTypeOffset(XSSFFont.SS_SUPER);
assertEquals(STVerticalAlignRun.SUPERSCRIPT, ctFont.getVertAlignArray(0).getVal());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTVerticalAlignFontProperty in project poi by apache.
the class XSSFFont method getTypeOffset.
/**
* get normal,super or subscript.
*
* @return short - offset type to use (none,super,sub)
* @see Font#SS_NONE
* @see Font#SS_SUPER
* @see Font#SS_SUB
*/
public short getTypeOffset() {
CTVerticalAlignFontProperty vAlign = _ctFont.sizeOfVertAlignArray() == 0 ? null : _ctFont.getVertAlignArray(0);
if (vAlign == null) {
return Font.SS_NONE;
}
int val = vAlign.getVal().intValue();
switch(val) {
case STVerticalAlignRun.INT_BASELINE:
return Font.SS_NONE;
case STVerticalAlignRun.INT_SUBSCRIPT:
return Font.SS_SUB;
case STVerticalAlignRun.INT_SUPERSCRIPT:
return Font.SS_SUPER;
default:
throw new POIXMLException("Wrong offset value " + val);
}
}
Aggregations