Search in sources :

Example 6 with Enum

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

the class XSSFDataValidation method getConstraint.

private static XSSFDataValidationConstraint getConstraint(CTDataValidation ctDataValidation) {
    String formula1 = ctDataValidation.getFormula1();
    String formula2 = ctDataValidation.getFormula2();
    Enum operator = ctDataValidation.getOperator();
    org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationType.Enum type = ctDataValidation.getType();
    Integer validationType = XSSFDataValidation.validationTypeReverseMappings.get(type);
    Integer operatorType = XSSFDataValidation.operatorTypeReverseMappings.get(operator);
    return new XSSFDataValidationConstraint(validationType, operatorType, formula1, formula2);
}
Also used : Enum(org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationOperator.Enum) STDataValidationType(org.openxmlformats.schemas.spreadsheetml.x2006.main.STDataValidationType)

Example 7 with Enum

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

the class XSSFCellStyle method getBorderLeftEnum.

/**
     * Get the type of border to use for the left border of the cell
     * Will be removed when {@link #getBorderLeft()} returns a BorderStyle enum
     *
     * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
     * @since POI 3.15
     */
@Override
public BorderStyle getBorderLeftEnum() {
    if (!_cellXf.getApplyBorder())
        return BorderStyle.NONE;
    int idx = (int) _cellXf.getBorderId();
    CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
    STBorderStyle.Enum ptrn = ct.isSetLeft() ? ct.getLeft().getStyle() : null;
    if (ptrn == null) {
        return BorderStyle.NONE;
    }
    return BorderStyle.valueOf((short) (ptrn.intValue() - 1));
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) STBorderStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)

Example 8 with Enum

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

the class XSSFCellStyle method getBorderBottomEnum.

/**
     * Get the type of border to use for the bottom border of the cell
     * Will be removed when {@link #getBorderBottom()} returns a BorderStyle enum
     *
     * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
     * @since POI 3.15
     */
@Override
public BorderStyle getBorderBottomEnum() {
    if (!_cellXf.getApplyBorder())
        return BorderStyle.NONE;
    int idx = (int) _cellXf.getBorderId();
    CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
    STBorderStyle.Enum ptrn = ct.isSetBottom() ? ct.getBottom().getStyle() : null;
    if (ptrn == null) {
        return BorderStyle.NONE;
    }
    return BorderStyle.valueOf((short) (ptrn.intValue() - 1));
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) STBorderStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)

Example 9 with Enum

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

the class XSSFCellStyle method getBorderRightEnum.

/**
     * Get the type of border to use for the right border of the cell
     * Will be removed when {@link #getBorderRight()} returns a BorderStyle enum
     *
     * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
     * @since POI 3.15
     */
@Override
public BorderStyle getBorderRightEnum() {
    if (!_cellXf.getApplyBorder())
        return BorderStyle.NONE;
    int idx = (int) _cellXf.getBorderId();
    CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
    STBorderStyle.Enum ptrn = ct.isSetRight() ? ct.getRight().getStyle() : null;
    if (ptrn == null) {
        return BorderStyle.NONE;
    }
    return BorderStyle.valueOf((short) (ptrn.intValue() - 1));
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) STBorderStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)

Example 10 with Enum

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

the class XSSFCellStyle method getBorderTopEnum.

/**
     * Get the type of border to use for the top border of the cell
     * Will be removed when {@link #getBorderTop()} returns a BorderStyle enum
     *
     * @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
     * @since POI 3.15
     */
@Override
public BorderStyle getBorderTopEnum() {
    if (!_cellXf.getApplyBorder())
        return BorderStyle.NONE;
    int idx = (int) _cellXf.getBorderId();
    CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
    STBorderStyle.Enum ptrn = ct.isSetTop() ? ct.getTop().getStyle() : null;
    if (ptrn == null) {
        return BorderStyle.NONE;
    }
    return BorderStyle.valueOf((short) (ptrn.intValue() - 1));
}
Also used : CTBorder(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder) STBorderStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle)

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