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

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

Introduction

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

Prototype

public static BorderStyle valueOf(short code) 

Source Link

Usage

From source file:org.jkiss.dbeaver.data.office.export.DataExporterXLSX.java

License:Apache License

@Override
public void init(IStreamDataExporterSite site) throws DBException {
    Object nullStringProp = site.getProperties().get(PROP_NULL_STRING);
    nullString = nullStringProp == null ? null : nullStringProp.toString();

    try {/*w  ww  .ja v a2 s  .c  o  m*/
        printHeader = (Boolean) site.getProperties().get(PROP_HEADER);
    } catch (Exception e) {
        printHeader = false;
    }

    try {
        rowNumber = (Boolean) site.getProperties().get(PROP_ROWNUMBER);
    } catch (Exception e) {
        rowNumber = false;
    }

    try {
        boolTrue = (String) site.getProperties().get(PROP_TRUESTRING);
    } catch (Exception e) {
        boolTrue = "true";
    }
    try {
        boolFalse = (String) site.getProperties().get(PROP_FALSESTRING);
    } catch (Exception e) {
        boolFalse = "false";
    }
    if (!"true".equals(boolTrue) || !"false".equals(boolFalse)) {
        booleRedefined = true;
    }

    try {
        exportSql = (Boolean) site.getProperties().get(PROP_EXPORT_SQL);
    } catch (Exception e) {
        exportSql = false;
    }

    try {
        splitSqlText = (Boolean) site.getProperties().get(PROP_SPLIT_SQLTEXT);
    } catch (Exception e) {
        splitSqlText = false;
    }

    try {
        splitByRowCount = (Integer) site.getProperties().get(PROP_SPLIT_BYROWCOUNT);
    } catch (Exception e) {
        splitByRowCount = EXCEL2007MAXROWS;
    }

    try {
        splitByCol = (Integer) site.getProperties().get(PROP_SPLIT_BYCOL);
    } catch (Exception e) {
        splitByCol = -1;
    }

    wb = new SXSSFWorkbook(ROW_WINDOW);

    worksheets = new HashMap<>(1);

    styleHeader = (XSSFCellStyle) wb.createCellStyle();

    BorderStyle border;

    try {

        border = BorderStyle.valueOf((String) site.getProperties().get(PROP_BORDER));

    } catch (Exception e) {

        border = BorderStyle.NONE;

    }

    FontStyleProp fontStyle;

    try {

        fontStyle = FontStyleProp.valueOf((String) site.getProperties().get(PROP_HEADER_FONT));

    } catch (Exception e) {

        fontStyle = FontStyleProp.NONE;

    }

    styleHeader.setBorderTop(border);
    styleHeader.setBorderBottom(border);
    styleHeader.setBorderLeft(border);
    styleHeader.setBorderRight(border);

    XSSFFont fontBold = (XSSFFont) wb.createFont();

    switch (fontStyle) {

    case BOLD:
        fontBold.setBold(true);
        break;

    case ITALIC:
        fontBold.setItalic(true);
        break;

    case STRIKEOUT:
        fontBold.setStrikeout(true);
        break;

    case UNDERLINE:
        fontBold.setUnderline((byte) 3);
        break;

    default:
        break;
    }

    styleHeader.setFont(fontBold);

    style = (XSSFCellStyle) wb.createCellStyle();
    style.setBorderTop(border);
    style.setBorderBottom(border);
    style.setBorderLeft(border);
    style.setBorderRight(border);
    this.rowCount = 0;

    super.init(site);
}