Example usage for org.apache.poi.ss.util CellUtil LEFT_BORDER_COLOR

List of usage examples for org.apache.poi.ss.util CellUtil LEFT_BORDER_COLOR

Introduction

In this page you can find the example usage for org.apache.poi.ss.util CellUtil LEFT_BORDER_COLOR.

Prototype

String LEFT_BORDER_COLOR

To view the source code for org.apache.poi.ss.util CellUtil LEFT_BORDER_COLOR.

Click Source Link

Usage

From source file:org.joeffice.spreadsheet.actions.SetBordersAction.java

License:Apache License

public void setBorder(JTable currentTable, short thickness, short color) {
    SheetTableModel tableModel = (SheetTableModel) currentTable.getModel();
    List<Cell> selectedCells = CellUtils.getSelectedCells(currentTable, true);
    for (Cell cell : selectedCells) {
        Workbook workbook = cell.getSheet().getWorkbook();
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.BORDER_TOP, thickness);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.TOP_BORDER_COLOR, color);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.BORDER_LEFT, thickness);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.LEFT_BORDER_COLOR, color);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.BORDER_BOTTOM, thickness);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.BOTTOM_BORDER_COLOR, color);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.BORDER_RIGHT, thickness);
        CellUtil.setCellStyleProperty(cell, workbook, CellUtil.RIGHT_BORDER_COLOR, color);
        tableModel.fireTableCellUpdated(cell.getRowIndex(), cell.getColumnIndex());
    }/*from  w  w  w.  j  a  v a2 s . c o m*/
}