List of usage examples for org.apache.poi.ss.usermodel HorizontalAlignment CENTER
HorizontalAlignment CENTER
To view the source code for org.apache.poi.ss.usermodel HorizontalAlignment CENTER.
Click Source Link
From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl.java
License:Apache License
@Override public CellStyle getTitleStyle(short color) { CellStyle titleStyle = workbook.createCellStyle(); titleStyle.setAlignment(HorizontalAlignment.CENTER); titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); titleStyle.setWrapText(true);/*from w w w. j a va 2 s . c o m*/ return titleStyle; }
From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl.java
License:Apache License
@Override public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) { CellStyle style = workbook.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setDataFormat(STRING_FORMAT);/*from w w w .j a v a 2 s .c o m*/ if (isWarp) { style.setWrapText(true); } return style; }
From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl.java
License:Apache License
@Override public CellStyle getHeaderStyle(short color) { CellStyle titleStyle = workbook.createCellStyle(); Font font = workbook.createFont(); font.setFontHeightInPoints((short) 12); titleStyle.setFont(font);//from w ww. j av a 2s . c o m titleStyle.setAlignment(HorizontalAlignment.CENTER); titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); return titleStyle; }
From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl.java
License:Apache License
@Override public CellStyle stringNoneStyle(Workbook workbook, boolean isWarp) { CellStyle style = workbook.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setDataFormat(STRING_FORMAT);/* w w w .jav a 2 s . co m*/ if (isWarp) { style.setWrapText(true); } return style; }
From source file:cn.com.zhbook.component.poi.PoiPerformanceTest.java
License:Apache License
static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style;/*from www . j a va 2 s . co m*/ Font headerFont = wb.createFont(); headerFont.setFontHeightInPoints((short) 14); headerFont.setBold(true); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setFont(headerFont); style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); styles.put("header", style); Font monthFont = wb.createFont(); monthFont.setFontHeightInPoints((short) 12); monthFont.setColor(IndexedColors.RED.getIndex()); monthFont.setBold(true); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFont(monthFont); styles.put("red-bold", style); String[] nfmt = { "#,##0.00", "$#,##0.00", "m/d/yyyy" }; for (String fmt : nfmt) { style = wb.createCellStyle(); style.setDataFormat(wb.createDataFormat().getFormat(fmt)); styles.put(fmt, style); } return styles; }
From source file:com.catexpress.util.FormatosPOI.java
public CellStyle estiloProveedor(Workbook wb) { CellStyle estiloCelda = wb.createCellStyle(); Font fuente = wb.createFont(); fuente.setFontName("Calibri"); fuente.setBold(true);//from ww w . j av a 2 s . c o m fuente.setFontHeightInPoints((short) 32); fuente.setColor(IndexedColors.ROYAL_BLUE.getIndex()); estiloCelda.setFont(fuente); estiloCelda.setVerticalAlignment(VerticalAlignment.CENTER); estiloCelda.setAlignment(HorizontalAlignment.CENTER); return estiloCelda; }
From source file:com.catexpress.util.FormatosPOI.java
public CellStyle estiloColumnas(Workbook wb, int tipo) { CellStyle estiloCelda = wb.createCellStyle(); Font fuente = wb.createFont(); if (tipo == COLUMNA) { estiloCelda.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); estiloCelda.setFillPattern(CellStyle.SOLID_FOREGROUND); fuente.setBold(true);//w w w. ja va 2 s . c o m } if (tipo == SURTIDO) { fuente.setColor(IndexedColors.WHITE.getIndex()); estiloCelda.setFillForegroundColor(IndexedColors.ROYAL_BLUE.getIndex()); estiloCelda.setFillPattern(CellStyle.SOLID_FOREGROUND); } fuente.setFontName("Calibri"); fuente.setFontHeightInPoints((short) 11); estiloCelda.setFont(fuente); estiloCelda.setVerticalAlignment(VerticalAlignment.CENTER); estiloCelda.setAlignment(HorizontalAlignment.CENTER); if (tipo == COLUMNA) { estiloCelda.setBorderBottom(BorderStyle.MEDIUM); estiloCelda.setBorderTop(BorderStyle.MEDIUM); estiloCelda.setBorderLeft(BorderStyle.MEDIUM); estiloCelda.setBorderRight(BorderStyle.MEDIUM); } else { estiloCelda.setBorderBottom(BorderStyle.THIN); estiloCelda.setBorderTop(BorderStyle.THIN); estiloCelda.setBorderLeft(BorderStyle.THIN); estiloCelda.setBorderRight(BorderStyle.THIN); } return estiloCelda; }
From source file:com.catexpress.util.FormatosPOI.java
public CellStyle estiloTotales(Workbook wb) { CellStyle estiloCelda = wb.createCellStyle(); Font fuente = wb.createFont(); estiloCelda.setFillForegroundColor(IndexedColors.ROYAL_BLUE.getIndex()); estiloCelda.setFillPattern(CellStyle.SOLID_FOREGROUND); fuente.setFontName("Calibri"); fuente.setBold(true);/*from w w w .j a v a 2s .co m*/ fuente.setFontHeightInPoints((short) 14); fuente.setColor(IndexedColors.WHITE.getIndex()); estiloCelda.setFont(fuente); estiloCelda.setVerticalAlignment(VerticalAlignment.CENTER); estiloCelda.setAlignment(HorizontalAlignment.CENTER); estiloCelda.setBorderBottom(BorderStyle.MEDIUM); estiloCelda.setBorderTop(BorderStyle.MEDIUM); estiloCelda.setBorderLeft(BorderStyle.MEDIUM); estiloCelda.setBorderRight(BorderStyle.MEDIUM); return estiloCelda; }
From source file:com.catexpress.util.FormatosPOI.java
public CellStyle estiloCuadro(Workbook wb, int tipo) { CellStyle estiloCelda = wb.createCellStyle(); Font fuente = wb.createFont(); if (tipo == AMARILLO) { estiloCelda.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); estiloCelda.setFillPattern(CellStyle.SOLID_FOREGROUND); }/*from w ww. ja v a2 s . com*/ fuente.setFontName("Calibri"); fuente.setBold(true); fuente.setFontHeightInPoints((short) 12); estiloCelda.setFont(fuente); estiloCelda.setVerticalAlignment(VerticalAlignment.CENTER); estiloCelda.setAlignment(HorizontalAlignment.CENTER); estiloCelda.setBorderBottom(BorderStyle.THIN); estiloCelda.setBorderTop(BorderStyle.THIN); estiloCelda.setBorderLeft(BorderStyle.THIN); estiloCelda.setBorderRight(BorderStyle.THIN); return estiloCelda; }
From source file:com.catexpress.util.FormatosPOI.java
public CellStyle estiloHeader(Workbook wb, int tipo) { Font fuente = wb.createFont(); CreationHelper createHelper = wb.getCreationHelper(); fuente.setFontName("Calibri"); fuente.setBold(true);/* w ww. j ava2 s .c o m*/ if (tipo == TITULO || tipo == SUCURSAL || tipo == LABEL || tipo == FECHA) { fuente.setFontHeightInPoints((short) 16); } else if (tipo == USUARIO) { fuente.setFontHeightInPoints((short) 20); } CellStyle estiloCelda = wb.createCellStyle(); estiloCelda.setFont(fuente); if (tipo == TITULO || tipo == USUARIO || tipo == LABEL || tipo == FECHA) { estiloCelda.setFillForegroundColor(IndexedColors.WHITE.getIndex()); } else if (tipo == SUCURSAL) { estiloCelda.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); } estiloCelda.setFillPattern(CellStyle.SOLID_FOREGROUND); if (tipo == LABEL || tipo == FECHA) { estiloCelda.setWrapText(false); } else if (tipo == TITULO || tipo == SUCURSAL || tipo == USUARIO) { estiloCelda.setWrapText(true); } estiloCelda.setAlignment(HorizontalAlignment.CENTER); if (tipo == LABEL || tipo == FECHA) { estiloCelda.setVerticalAlignment(VerticalAlignment.BOTTOM); } else if (tipo == TITULO || tipo == SUCURSAL || tipo == USUARIO) { estiloCelda.setVerticalAlignment(VerticalAlignment.CENTER); } if (tipo == SUCURSAL) { estiloCelda.setBorderBottom(BorderStyle.MEDIUM); estiloCelda.setBorderTop(BorderStyle.MEDIUM); estiloCelda.setBorderLeft(BorderStyle.MEDIUM); estiloCelda.setBorderRight(BorderStyle.MEDIUM); } if (tipo == FECHA) { estiloCelda.setDataFormat(createHelper.createDataFormat().getFormat("dd \"de\" mmmm \"de\" yyyy")); } return estiloCelda; }