Example usage for org.apache.poi.ss.usermodel BorderStyle THICK

List of usage examples for org.apache.poi.ss.usermodel BorderStyle THICK

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel BorderStyle THICK.

Prototype

BorderStyle THICK

To view the source code for org.apache.poi.ss.usermodel BorderStyle THICK.

Click Source Link

Document

Thick border

Usage

From source file:uk.co.spudsoft.birt.emitters.excel.StyleManagerXUtils.java

License:Open Source License

/**
 * Converts a BIRT border style into a POI BorderStyle.
 * @param birtBorder/*from  w ww .  j a  va2s .c o m*/
 * The BIRT border style.
 * @param width
 * The width of the border as understood by BIRT.
 * @return
 * A POI BorderStyle object.
 */
private BorderStyle poiBorderStyleFromBirt(String birtBorder, String width) {
    if ("none".equals(birtBorder)) {
        return BorderStyle.NONE;
    }
    double pxWidth = 3.0;
    if (CSSConstants.CSS_THIN_VALUE.equals(width)) {
        pxWidth = 1.0;
    } else if (CSSConstants.CSS_MEDIUM_VALUE.equals(width)) {
        pxWidth = 3.0;
    } else if (CSSConstants.CSS_THICK_VALUE.equals(width)) {
        pxWidth = 4.0;
    } else {
        DimensionType dim = DimensionType.parserUnit(width);
        if (dim != null) {
            if ("px".equals(dim.getUnits())) {
                pxWidth = dim.getMeasure();
            }
        }
    }
    if ("solid".equals(birtBorder)) {
        if (pxWidth < 2.9) {
            return BorderStyle.THIN;
        } else if (pxWidth < 3.1) {
            return BorderStyle.MEDIUM;
        } else {
            return BorderStyle.THICK;
        }
    } else if ("dashed".equals(birtBorder)) {
        if (pxWidth < 2.9) {
            return BorderStyle.DASHED;
        } else {
            return BorderStyle.MEDIUM_DASHED;
        }
    } else if ("dotted".equals(birtBorder)) {
        return BorderStyle.DOTTED;
    } else if ("double".equals(birtBorder)) {
        return BorderStyle.DOUBLE;
    }

    log.debug("Border style \"", birtBorder, "\" is not recognised.");
    return BorderStyle.NONE;
}