Example usage for org.apache.poi.ss.usermodel HorizontalAlignment JUSTIFY

List of usage examples for org.apache.poi.ss.usermodel HorizontalAlignment JUSTIFY

Introduction

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

Prototype

HorizontalAlignment JUSTIFY

To view the source code for org.apache.poi.ss.usermodel HorizontalAlignment JUSTIFY.

Click Source Link

Document

The horizontal alignment is justified (flush left and right).

Usage

From source file:achmad.rifai.admin.ui.Saver.java

private void konten(int i, XSSFRow r, String s) {
    org.apache.poi.xssf.usermodel.XSSFCell c = r.createCell(i);
    c.setCellType(CellType.STRING);//from w w  w .j  a  v a2s. c om
    c.setCellValue(s);
    org.apache.poi.xssf.usermodel.XSSFCellStyle cs = c.getCellStyle();
    cs.setFillBackgroundColor(new org.apache.poi.xssf.usermodel.XSSFColor(Color.WHITE));
    cs.setFillForegroundColor(new org.apache.poi.xssf.usermodel.XSSFColor(Color.BLACK));
    cs.setAlignment(HorizontalAlignment.JUSTIFY);
    cs.setVerticalAlignment(VerticalAlignment.TOP);
    cs.setBorderBottom(BorderStyle.DASHED);
    cs.setBorderTop(BorderStyle.DASHED);
    cs.setBorderLeft(BorderStyle.DASHED);
    cs.setBorderRight(BorderStyle.DASHED);
}

From source file:com.github.ukase.toolkit.xlsx.XlsxUtil.java

License:Open Source License

static HorizontalAlignment prepareAlignment(IdentValue ident) {
    if (XlsxUtil.isLeft(ident)) {
        return HorizontalAlignment.LEFT;
    } else if (XlsxUtil.isRight(ident)) {
        return HorizontalAlignment.RIGHT;
    } else if (XlsxUtil.isJustify(ident)) {
        return HorizontalAlignment.JUSTIFY;
    }/*from   w w w .  ja v  a 2 s  .c om*/
    return HorizontalAlignment.CENTER;
}

From source file:jdbreport.model.io.xls.poi.Excel2003Writer.java

License:Apache License

protected HorizontalAlignment convertHorizontalAlign(int hAlignment) {
    switch (hAlignment) {
    case jdbreport.model.CellStyle.LEFT:
        return HorizontalAlignment.LEFT;
    case jdbreport.model.CellStyle.RIGHT:
        return HorizontalAlignment.RIGHT;
    case jdbreport.model.CellStyle.CENTER:
        return HorizontalAlignment.CENTER;
    case jdbreport.model.CellStyle.JUSTIFY:
        return HorizontalAlignment.JUSTIFY;
    }//from w w  w  .  j  a  v a 2s .  c om
    return HorizontalAlignment.LEFT;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.HSSFCellStyleProducer.java

License:Open Source License

/**
 * Converts the given element alignment into one of the HorizontalAlignment-constants.
 *
 * @param e the JFreeReport element alignment.
 * @return the HorizontalAlignment-Alignment.
 * @throws IllegalArgumentException if an Unknown JFreeReport alignment is given.
 *//*from  w  w w . j av a 2  s  .  com*/
protected static HorizontalAlignment convertHorizontalAlignment(final ElementAlignment e) {
    if (ElementAlignment.LEFT.equals(e)) {
        return HorizontalAlignment.LEFT;
    } else if (ElementAlignment.RIGHT.equals(e)) {
        return HorizontalAlignment.RIGHT;
    } else if (ElementAlignment.JUSTIFY.equals(e)) {
        return HorizontalAlignment.JUSTIFY;
    } else if (ElementAlignment.CENTER.equals(e)) {
        return HorizontalAlignment.CENTER;
    }

    throw new IllegalArgumentException("Invalid alignment");
}