List of usage examples for org.apache.poi.ss.usermodel CellStyle setWrapText
void setWrapText(boolean wrapped);
From source file:Utilities.ExportToXLSX.java
private CellStyle createStandardStyle() { CellStyle style = wb.createCellStyle(); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setWrapText(true); return style; }
From source file:Utilities.ExportToXLSX.java
private CellStyle createSSNStyle() { Font font3 = wb.createFont(); DataFormat df = wb.createDataFormat(); CellStyle style = wb.createCellStyle(); style = createStandardStyle();//from ww w . j a v a2 s. c o m style.setDataFormat(df.getFormat("0000")); style.setAlignment(CellStyle.ALIGN_LEFT); //style.setFont(font3); style.setWrapText(true); return style; }
From source file:Utilities.ExportToXLSX.java
private CellStyle createFormulaStyle() { Font font3 = wb.createFont(); DataFormat df = wb.createDataFormat(); CellStyle style = wb.createCellStyle(); // font3.setFontHeightInPoints((short)14); // font3.setColor(IndexedColors.DARK_BLUE.getIndex()); // font3.setBoldweight(Font.BOLDWEIGHT_BOLD); style = createStandardStyle();//from w ww . j a v a2s . c o m style.setAlignment(CellStyle.ALIGN_LEFT); //style.setFont(font3); style.setWrapText(true); return style; }
From source file:Utilities.GlobalVar.java
public static CellStyle createStandardStyle(XSSFWorkbook myWorkBook) { CellStyle style = myWorkBook.createCellStyle(); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setWrapText(true); return style; }
From source file:utilities.XlsxGenerator.java
private CellStyle createStandardStyle() { CellStyle style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); Font font = wb.createFont();// ww w. ja v a2 s . c o m font.setFontName("Arial"); font.setFontHeightInPoints((short) 8); style.setFont(font); // style.setBorderRight(CellStyle.BORDER_THIN); // style.setRightBorderColor(IndexedColors.BLACK.getIndex()); // style.setBorderBottom(CellStyle.BORDER_THIN); // style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // style.setBorderLeft(CellStyle.BORDER_THIN); // style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // style.setBorderTop(CellStyle.BORDER_THIN); // style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setWrapText(true); return style; }
From source file:utilities.XlsxGenerator.java
private CellStyle createSSNStyle() { Font font3 = wb.createFont(); DataFormat df = wb.createDataFormat(); CellStyle style = wb.createCellStyle(); style = createStandardStyle();/*from w ww .j a v a 2s . com*/ style.setDataFormat(df.getFormat("000-00-0000")); style.setAlignment(CellStyle.ALIGN_LEFT); //style.setFont(font3); style.setWrapText(true); return style; }
From source file:vistas.reportes.procesos.rptVacacionesExcel.java
private Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style; Font titleFont = wb.createFont(); titleFont.setFontHeightInPoints((short) 18); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style = wb.createCellStyle();/*from www. j a va 2 s .com*/ style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(titleFont); styles.put("title", style); Font monthFont = wb.createFont(); monthFont.setFontHeightInPoints((short) 11); monthFont.setColor(IndexedColors.WHITE.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont(monthFont); style.setWrapText(true); styles.put("header", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setWrapText(true); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); styles.put("cell", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setDataFormat(wb.createDataFormat().getFormat("0.00")); styles.put("formula", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setDataFormat(wb.createDataFormat().getFormat("0.00")); styles.put("formula_2", style); return styles; }
From source file:workbench.db.exporter.XlsRowDataConverter.java
License:Apache License
private void writeInfoSheet() { Sheet info = workbook.getSheet(INFO_SHEETNAME); if (info == null) { info = workbook.createSheet(INFO_SHEETNAME); Row headRow = info.createRow(0); Cell cell = headRow.createCell(0); setCellValueAndStyle(cell, ResourceMgr.getString("TxtSheet"), true, false, 0); cell = headRow.createCell(1);/*ww w . j a v a 2 s . c o m*/ setCellValueAndStyle(cell, "SQL", true, false, 1); } else { // move the info sheet to the end int count = workbook.getNumberOfSheets(); workbook.setSheetOrder(info.getSheetName(), count - 1); } int rowNum = info.getLastRowNum() + 1; Row infoRow = info.createRow(rowNum); Cell name = infoRow.createCell(0); CellStyle nameStyle = workbook.createCellStyle(); nameStyle.setAlignment(CellStyle.ALIGN_LEFT); nameStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP); nameStyle.setWrapText(false); name.setCellValue(sheet.getSheetName()); name.setCellStyle(nameStyle); info.autoSizeColumn(0); Cell sqlCell = infoRow.createCell(1); CellStyle sqlStyle = workbook.createCellStyle(); sqlStyle.setAlignment(CellStyle.ALIGN_LEFT); sqlStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP); sqlStyle.setWrapText(false); RichTextString s = workbook.getCreationHelper().createRichTextString(generatingSql); sqlCell.setCellValue(s); sqlCell.setCellStyle(sqlStyle); }