Java Code Examples for org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
The following examples show how to use
org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StyleManagerHUtils.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Converts a BIRT border style into a POI border style (short constant defined in CellStyle). * @param birtBorder * The BIRT border style. * @param width * The width of the border as understood by BIRT. * @return * One of the CellStyle BORDER constants. */ private short poiBorderStyleFromBirt( String birtBorder, String width ) { if( "none".equals(birtBorder) ) { return CellStyle.BORDER_NONE; } DimensionType dim = DimensionType.parserUnit( width ); double pxWidth = 3.0; if( ( dim != null ) && ( "px".equals(dim.getUnits()) ) ){ pxWidth = dim.getMeasure(); } if( "solid".equals(birtBorder) ) { if( pxWidth < 2.9 ) { return CellStyle.BORDER_THIN; } else if( pxWidth < 3.1 ) { return CellStyle.BORDER_MEDIUM; } else { return CellStyle.BORDER_THICK; } } else if( "dashed".equals(birtBorder) ) { if( pxWidth < 2.9 ) { return CellStyle.BORDER_DASHED; } else { return CellStyle.BORDER_MEDIUM_DASHED; } } else if( "dotted".equals(birtBorder) ) { return CellStyle.BORDER_DOTTED; } else if( "double".equals(birtBorder) ) { return CellStyle.BORDER_DOUBLE; } else if( "none".equals(birtBorder) ) { return CellStyle.BORDER_NONE; } log.debug( "Border style \"", birtBorder, "\" is not recognised" ); return CellStyle.BORDER_NONE; }
Example 2
Source File: XssfBorderLineStyleResolver.java From xlsbeans with Apache License 2.0 | 4 votes |
public static WBorderLineStyle resolve(short cellStyle) { WBorderLineStyle style = null; switch (cellStyle) { case CellStyle.BORDER_NONE: style = WBorderLineStyle.NONE; break; case CellStyle.BORDER_THIN: style = WBorderLineStyle.THIN; break; case CellStyle.BORDER_MEDIUM: style = WBorderLineStyle.MEDIUM; break; case CellStyle.BORDER_DASHED: style = WBorderLineStyle.DASHED; break; case CellStyle.BORDER_DOTTED: style = WBorderLineStyle.DOTTED; break; case CellStyle.BORDER_THICK: style = WBorderLineStyle.THICK; break; case CellStyle.BORDER_DOUBLE: style = WBorderLineStyle.DOUBLE; break; case CellStyle.BORDER_HAIR: style = WBorderLineStyle.HAIR; break; case CellStyle.BORDER_MEDIUM_DASHED: style = WBorderLineStyle.MEDIUM_DASHED; break; case CellStyle.BORDER_DASH_DOT: style = WBorderLineStyle.DASH_DOT; break; case CellStyle.BORDER_MEDIUM_DASH_DOT: style = WBorderLineStyle.MEDIUM_DASH_DOT; break; case CellStyle.BORDER_MEDIUM_DASH_DOT_DOT: style = WBorderLineStyle.MEDIUM_DASH_DOT_DOT; break; case CellStyle.BORDER_SLANTED_DASH_DOT: style = WBorderLineStyle.SLANTED_DASH_DOT; break; default: style = WBorderLineStyle.NONE; break; } return style; }
Example 3
Source File: StyleManagerHUtils.java From birt with Eclipse Public License 1.0 | 4 votes |
@Override public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) { if( ( colour != null ) || ( borderStyle != null ) || ( width != null ) ) { String colourString = colour == null ? "rgb(0,0,0)" : colour.getCssText(); String borderStyleString = borderStyle == null ? "solid" : borderStyle.getCssText(); String widthString = width == null ? "medium" : width.getCssText(); if( style instanceof HSSFCellStyle ) { HSSFCellStyle hStyle = (HSSFCellStyle)style; short hBorderStyle = poiBorderStyleFromBirt(borderStyleString, widthString); short colourIndex = getHColour((HSSFWorkbook)workbook, colourString); if( colourIndex > 0 ) { if(hBorderStyle != CellStyle.BORDER_NONE) { switch( side ) { case TOP: hStyle.setBorderTop(hBorderStyle); hStyle.setTopBorderColor(colourIndex); // log.debug( "Top border: " + xStyle.getBorderTop() + " / " + xStyle.getTopBorderXSSFColor().getARGBHex() ); break; case LEFT: hStyle.setBorderLeft(hBorderStyle); hStyle.setLeftBorderColor(colourIndex); // log.debug( "Left border: " + xStyle.getBorderLeft() + " / " + xStyle.getLeftBorderXSSFColor().getARGBHex() ); break; case RIGHT: hStyle.setBorderRight(hBorderStyle); hStyle.setRightBorderColor(colourIndex); // log.debug( "Right border: " + xStyle.getBorderRight() + " / " + xStyle.getRightBorderXSSFColor().getARGBHex() ); break; case BOTTOM: hStyle.setBorderBottom(hBorderStyle); hStyle.setBottomBorderColor(colourIndex); // log.debug( "Bottom border: " + xStyle.getBorderBottom() + " / " + xStyle.getBottomBorderXSSFColor().getARGBHex() ); break; } } } } } }
Example 4
Source File: XssfBorderLineStyleResolver.java From xlsbeans with Apache License 2.0 | 4 votes |
public static WBorderLineStyle resolve(short cellStyle) { WBorderLineStyle style = null; switch (cellStyle) { case CellStyle.BORDER_NONE: style = WBorderLineStyle.NONE; break; case CellStyle.BORDER_THIN: style = WBorderLineStyle.THIN; break; case CellStyle.BORDER_MEDIUM: style = WBorderLineStyle.MEDIUM; break; case CellStyle.BORDER_DASHED: style = WBorderLineStyle.DASHED; break; case CellStyle.BORDER_DOTTED: style = WBorderLineStyle.DOTTED; break; case CellStyle.BORDER_THICK: style = WBorderLineStyle.THICK; break; case CellStyle.BORDER_DOUBLE: style = WBorderLineStyle.DOUBLE; break; case CellStyle.BORDER_HAIR: style = WBorderLineStyle.HAIR; break; case CellStyle.BORDER_MEDIUM_DASHED: style = WBorderLineStyle.MEDIUM_DASHED; break; case CellStyle.BORDER_DASH_DOT: style = WBorderLineStyle.DASH_DOT; break; case CellStyle.BORDER_MEDIUM_DASH_DOT: style = WBorderLineStyle.MEDIUM_DASH_DOT; break; case CellStyle.BORDER_MEDIUM_DASH_DOT_DOT: style = WBorderLineStyle.MEDIUM_DASH_DOT_DOT; break; case CellStyle.BORDER_SLANTED_DASH_DOT: style = WBorderLineStyle.SLANTED_DASH_DOT; break; default: style = WBorderLineStyle.NONE; break; } return style; }