Search in sources :

Example 1 with Enum

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

the class XSSFDataValidationConstraint method prettyPrint.

public String prettyPrint() {
    StringBuilder builder = new StringBuilder();
    STDataValidationType.Enum vt = XSSFDataValidation.validationTypeMappings.get(validationType);
    Enum ot = XSSFDataValidation.operatorTypeMappings.get(operator);
    builder.append(vt);
    builder.append(' ');
    if (validationType != ValidationType.ANY) {
        if (validationType != ValidationType.LIST && validationType != ValidationType.FORMULA) {
            builder.append(LIST_SEPARATOR).append(ot).append(", ");
        }
        final String NOQUOTE = "";
        if (validationType == ValidationType.LIST && explicitListOfValues != null) {
            builder.append(NOQUOTE).append(Arrays.asList(explicitListOfValues)).append(NOQUOTE).append(' ');
        } else {
            builder.append(NOQUOTE).append(formula1).append(NOQUOTE).append(' ');
        }
        if (formula2 != null) {
            builder.append(NOQUOTE).append(formula2).append(NOQUOTE).append(' ');
        }
    }
    return builder.toString();
}
Also used : Enum(org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationOperator.Enum) STDataValidationType(org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationType)

Example 2 with Enum

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

the class XSSFFont method setUnderline.

/**
     * set an enumeration representing the style of underlining that is used.
     * The none style is equivalent to not using underlining at all.
     * The possible values for this attribute are defined by the FontUnderline
     *
     * @param underline - FontUnderline enum value
     */
public void setUnderline(FontUnderline underline) {
    if (underline == FontUnderline.NONE && _ctFont.sizeOfUArray() > 0) {
        _ctFont.setUArray(null);
    } else {
        CTUnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.addNewU() : _ctFont.getUArray(0);
        STUnderlineValues.Enum val = STUnderlineValues.Enum.forInt(underline.getValue());
        ctUnderline.setVal(val);
    }
}
Also used : STUnderlineValues(org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnderlineValues) CTUnderlineProperty(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTUnderlineProperty)

Example 3 with Enum

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

the class XSSFFont method setScheme.

/**
     * set font scheme property
     *
     * @param scheme - FontScheme enum value
     * @see FontScheme
     */
public void setScheme(FontScheme scheme) {
    CTFontScheme ctFontScheme = _ctFont.sizeOfSchemeArray() == 0 ? _ctFont.addNewScheme() : _ctFont.getSchemeArray(0);
    STFontScheme.Enum val = STFontScheme.Enum.forInt(scheme.getValue());
    ctFontScheme.setVal(val);
}
Also used : CTFontScheme(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontScheme) STFontScheme(org.openxmlformats.schemas.spreadsheetml.x2006.main.STFontScheme)

Example 4 with Enum

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

the class XSSFSingleXmlCell method getXmlDataType.

public Enum getXmlDataType() {
    CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
    CTXmlPr xmlPr = xmlCellPr.getXmlPr();
    return xmlPr.getXmlDataType();
}
Also used : CTXmlCellPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlCellPr) CTXmlPr(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlPr)

Example 5 with Enum

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

the class TestXSSFCellStyle method testGetSetBorderNone.

// Border Styles, in BorderStyle/STBorderStyle enum order
@Test
public void testGetSetBorderNone() {
    cellStyle.setBorderTop(BorderStyle.NONE);
    assertEquals(BorderStyle.NONE, cellStyle.getBorderTopEnum());
    int borderId = (int) cellStyle.getCoreXf().getBorderId();
    assertTrue(borderId > 0);
    //check changes in the underlying xml bean
    CTBorder ctBorder = stylesTable.getBorderAt(borderId).getCTBorder();
    assertNull(ctBorder.getTop());
// no border style and STBorderStyle.NONE are equivalent
// POI prefers to unset the border style than explicitly set it STBorderStyle.NONE
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) Test(org.junit.Test)

Aggregations

CTBorder (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder)5 STBorderStyle (org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)4 Enum (org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationOperator.Enum)2 STDataValidationType (org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationType)2 Test (org.junit.Test)1 CTFontScheme (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontScheme)1 CTUnderlineProperty (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTUnderlineProperty)1 CTXmlCellPr (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlCellPr)1 CTXmlPr (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlPr)1 STFontScheme (org.openxmlformats.schemas.spreadsheetml.x2006.main.STFontScheme)1 STUnderlineValues (org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnderlineValues)1