List of usage examples for org.apache.poi.ss.usermodel IndexedColors BROWN
IndexedColors BROWN
To view the source code for org.apache.poi.ss.usermodel IndexedColors BROWN.
Click Source Link
From source file:com.vincestyling.apkinfoextractor.core.export.ExportToExcel.java
License:Apache License
private Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<>(); String fontName = getAvaliableTitleFont(); CellStyle style;/*from ww w .j a v a2 s . c o m*/ Font font = wb.createFont(); font.setFontName(fontName); font.setFontHeightInPoints((short) 14); font.setColor(IndexedColors.BROWN.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(font); styles.put("title", style); font = wb.createFont(); font.setFontName(fontName); font.setFontHeightInPoints((short) 14); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setColor(IndexedColors.WHITE.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFont(font); style.setWrapText(true); setBorder(style); styles.put("header", style); font = wb.createFont(); font.setFontName(fontName); font.setFontHeightInPoints((short) 12); font.setColor(IndexedColors.BLACK.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setWrapText(true); style.setFont(font); setBorder(style); styles.put("cell", style); return styles; }
From source file:org.alanwilliamson.openbd.plugin.spreadsheet.SpreadSheetFormatOptions.java
License:Open Source License
public static void initialize() { lookup_colors = new HashMap<String, Short>(); lookup_alignment = new HashMap<String, Short>(); lookup_border = new HashMap<String, Short>(); lookup_fillpatten = new HashMap<String, Short>(); lookup_underline = new HashMap<String, Byte>(); lookup_color = new HashMap<String, Color>(); lookup_underline.put("double", Font.U_DOUBLE); lookup_underline.put("double_accounting", Font.U_DOUBLE_ACCOUNTING); lookup_underline.put("single", Font.U_SINGLE); lookup_underline.put("single_accounting", Font.U_SINGLE_ACCOUNTING); lookup_underline.put("none", Font.U_NONE); lookup_colors.put("black", IndexedColors.BLACK.getIndex()); lookup_colors.put("brown", IndexedColors.BROWN.getIndex()); lookup_colors.put("olive_green", IndexedColors.OLIVE_GREEN.getIndex()); lookup_colors.put("dark_green", IndexedColors.DARK_GREEN.getIndex()); lookup_colors.put("dark_teal", IndexedColors.DARK_TEAL.getIndex()); lookup_colors.put("dark_blue", IndexedColors.DARK_BLUE.getIndex()); lookup_colors.put("indigo", IndexedColors.INDIGO.getIndex()); lookup_colors.put("grey_80_percent", IndexedColors.GREY_80_PERCENT.getIndex()); lookup_colors.put("grey_50_percent", IndexedColors.GREY_50_PERCENT.getIndex()); lookup_colors.put("grey_40_percent", IndexedColors.GREY_40_PERCENT.getIndex()); lookup_colors.put("grey_25_percent", IndexedColors.GREY_25_PERCENT.getIndex()); lookup_colors.put("orange", IndexedColors.ORANGE.getIndex()); lookup_colors.put("dark_yellow", IndexedColors.DARK_YELLOW.getIndex()); lookup_colors.put("green", IndexedColors.GREEN.getIndex()); lookup_colors.put("teal", IndexedColors.TEAL.getIndex()); lookup_colors.put("blue", IndexedColors.BLUE.getIndex()); lookup_colors.put("blue_grey", IndexedColors.BLUE_GREY.getIndex()); lookup_colors.put("red", IndexedColors.RED.getIndex()); lookup_colors.put("light_orange", IndexedColors.LIGHT_ORANGE.getIndex()); lookup_colors.put("lime", IndexedColors.LIME.getIndex()); lookup_colors.put("sea_green", IndexedColors.SEA_GREEN.getIndex()); lookup_colors.put("aqua", IndexedColors.AQUA.getIndex()); lookup_colors.put("light_blue", IndexedColors.LIGHT_BLUE.getIndex()); lookup_colors.put("violet", IndexedColors.VIOLET.getIndex()); lookup_colors.put("pink", IndexedColors.PINK.getIndex()); lookup_colors.put("gold", IndexedColors.GOLD.getIndex()); lookup_colors.put("yellow", IndexedColors.YELLOW.getIndex()); lookup_colors.put("bright_green", IndexedColors.BRIGHT_GREEN.getIndex()); lookup_colors.put("turquoise", IndexedColors.TURQUOISE.getIndex()); lookup_colors.put("dark_red", IndexedColors.DARK_RED.getIndex()); lookup_colors.put("sky_blue", IndexedColors.SKY_BLUE.getIndex()); lookup_colors.put("plum", IndexedColors.PLUM.getIndex()); lookup_colors.put("rose", IndexedColors.ROSE.getIndex()); lookup_colors.put("light_yellow", IndexedColors.LIGHT_YELLOW.getIndex()); lookup_colors.put("light_green", IndexedColors.LIGHT_GREEN.getIndex()); lookup_colors.put("light_turquoise", IndexedColors.LIGHT_TURQUOISE.getIndex()); lookup_colors.put("pale_blue", IndexedColors.PALE_BLUE.getIndex()); lookup_colors.put("lavender", IndexedColors.LAVENDER.getIndex()); lookup_colors.put("white", IndexedColors.WHITE.getIndex()); lookup_colors.put("cornflower_blue", IndexedColors.CORNFLOWER_BLUE.getIndex()); lookup_colors.put("lemon_chiffon", IndexedColors.LEMON_CHIFFON.getIndex()); lookup_colors.put("maroon", IndexedColors.MAROON.getIndex()); lookup_colors.put("orchid", IndexedColors.ORCHID.getIndex()); lookup_colors.put("coral", IndexedColors.CORAL.getIndex()); lookup_colors.put("royal_blue", IndexedColors.ROYAL_BLUE.getIndex()); lookup_colors.put("light_cornflower_blue", IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); lookup_alignment.put("left", CellStyle.ALIGN_LEFT); lookup_alignment.put("right", CellStyle.ALIGN_RIGHT); lookup_alignment.put("center", CellStyle.ALIGN_CENTER); lookup_alignment.put("justify", CellStyle.ALIGN_JUSTIFY); lookup_alignment.put("general", CellStyle.ALIGN_GENERAL); lookup_alignment.put("fill", CellStyle.ALIGN_FILL); lookup_alignment.put("center_selection", CellStyle.ALIGN_CENTER_SELECTION); lookup_alignment.put("vertical_top", CellStyle.VERTICAL_TOP); lookup_alignment.put("vertical_bottom", CellStyle.VERTICAL_BOTTOM); lookup_alignment.put("vertical_center", CellStyle.VERTICAL_CENTER); lookup_alignment.put("vertical_justify", CellStyle.VERTICAL_JUSTIFY); lookup_border.put("none", CellStyle.BORDER_NONE); lookup_border.put("thin", CellStyle.BORDER_THIN); lookup_border.put("medium", CellStyle.BORDER_MEDIUM); lookup_border.put("dashed", CellStyle.BORDER_DASHED); lookup_border.put("hair", CellStyle.BORDER_HAIR); lookup_border.put("thick", CellStyle.BORDER_THICK); lookup_border.put("double", CellStyle.BORDER_DOUBLE); lookup_border.put("dotted", CellStyle.BORDER_DOTTED); lookup_border.put("medium_dashed", CellStyle.BORDER_MEDIUM_DASHED); lookup_border.put("dash_dot", CellStyle.BORDER_DASH_DOT); lookup_border.put("medium_dash_dot", CellStyle.BORDER_MEDIUM_DASH_DOT); lookup_border.put("dash_dot_dot", CellStyle.BORDER_DASH_DOT_DOT); lookup_border.put("medium_dash_dot_dot", CellStyle.BORDER_MEDIUM_DASH_DOT_DOT); lookup_border.put("slanted_dash_dot", CellStyle.BORDER_SLANTED_DASH_DOT); lookup_fillpatten.put("big_spots", CellStyle.BIG_SPOTS); lookup_fillpatten.put("squares", CellStyle.SQUARES); lookup_fillpatten.put("nofill", CellStyle.NO_FILL); lookup_fillpatten.put("solid_foreground", CellStyle.SOLID_FOREGROUND); lookup_fillpatten.put("fine_dots", CellStyle.FINE_DOTS); lookup_fillpatten.put("alt_bars", CellStyle.ALT_BARS); lookup_fillpatten.put("sparse_dots", CellStyle.SPARSE_DOTS); lookup_fillpatten.put("thick_horz_bands", CellStyle.THICK_HORZ_BANDS); lookup_fillpatten.put("thick_vert_bands", CellStyle.THICK_VERT_BANDS); lookup_fillpatten.put("thick_backward_diag", CellStyle.THICK_BACKWARD_DIAG); lookup_fillpatten.put("thick_forward_diag", CellStyle.THICK_FORWARD_DIAG); lookup_fillpatten.put("thin_horz_bands", CellStyle.THIN_HORZ_BANDS); lookup_fillpatten.put("thin_vert_bands", CellStyle.THIN_VERT_BANDS); lookup_fillpatten.put("thin_backward_diag", CellStyle.THIN_BACKWARD_DIAG); lookup_fillpatten.put("thin_forward_diag", CellStyle.THIN_FORWARD_DIAG); lookup_fillpatten.put("diamonds", CellStyle.DIAMONDS); lookup_fillpatten.put("less_dots", CellStyle.LESS_DOTS); lookup_fillpatten.put("least_dots", CellStyle.LEAST_DOTS); lookup_color.put("black", Color.BLACK); lookup_color.put("blue", Color.BLUE); lookup_color.put("cyan", Color.CYAN); lookup_color.put("dark_gray", Color.DARK_GRAY); lookup_color.put("darkGray", Color.DARK_GRAY); lookup_color.put("gray", Color.GRAY); lookup_color.put("green", Color.GREEN); lookup_color.put("light_gray", Color.LIGHT_GRAY); lookup_color.put("lightGray", Color.LIGHT_GRAY); lookup_color.put("magenta", Color.MAGENTA); lookup_color.put("orange", Color.ORANGE); lookup_color.put("pink", Color.PINK); lookup_color.put("red", Color.RED); lookup_color.put("white", Color.WHITE); lookup_color.put("yellow", Color.YELLOW); }
From source file:org.generationcp.breeding.manager.crossingmanager.util.CrossingManagerExporter.java
License:Open Source License
private HashMap<String, CellStyle> createStyles(HSSFWorkbook wb) { HashMap<String, CellStyle> styles = new HashMap<String, CellStyle>(); // set cell style for labels in the description sheet CellStyle labelStyle = wb.createCellStyle(); labelStyle.setFillForegroundColor(IndexedColors.BROWN.getIndex()); labelStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); Font labelFont = wb.createFont(); labelFont.setColor(IndexedColors.WHITE.getIndex()); labelFont.setBoldweight(Font.BOLDWEIGHT_BOLD); labelStyle.setFont(labelFont);/* ww w .j a va 2 s . co m*/ styles.put(LABEL_STYLE, labelStyle); // set cell style for headings related to Conditions/Factors CellStyle factorHeadingStyle = wb.createCellStyle(); factorHeadingStyle.setFillForegroundColor(IndexedColors.SEA_GREEN.getIndex()); factorHeadingStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); factorHeadingStyle.setAlignment(CellStyle.ALIGN_CENTER); Font factorHeadingfont = wb.createFont(); factorHeadingfont.setColor(IndexedColors.WHITE.getIndex()); factorHeadingfont.setBoldweight(Font.BOLDWEIGHT_BOLD); factorHeadingStyle.setFont(factorHeadingfont); styles.put(FACTOR_HEADING_STYLE, factorHeadingStyle); // set cell style for headings related to Constants/Variates CellStyle variateHeadingStyle = wb.createCellStyle(); variateHeadingStyle.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex()); variateHeadingStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); variateHeadingStyle.setAlignment(CellStyle.ALIGN_CENTER); Font variateHeadingFont = wb.createFont(); variateHeadingFont.setColor(IndexedColors.WHITE.getIndex()); variateHeadingFont.setBoldweight(Font.BOLDWEIGHT_BOLD); variateHeadingStyle.setFont(variateHeadingFont); styles.put(VARIATE_HEADING_STYLE, variateHeadingStyle); //set cell style for numeric values (left alignment) CellStyle numericStyle = wb.createCellStyle(); numericStyle.setAlignment(CellStyle.ALIGN_LEFT); styles.put(NUMERIC_STYLE, numericStyle); return styles; }
From source file:org.kuali.test.runner.output.PoiHelper.java
License:Educational Community License
private void createPoiCellStyles(Workbook workbook) { // create bold cell style Font font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setFontHeightInPoints((short) 10); cellStyleBold = workbook.createCellStyle(); cellStyleBold.setFont(font);// ww w . j a v a2 s .co m // create standard cell style font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_NORMAL); font.setFontHeightInPoints((short) 10); cellStyleNormal = workbook.createCellStyle(); cellStyleNormal.setFont(font); cellStyleNormal.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create test header cell style font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setFontHeightInPoints((short) 10); cellStyleTestHeader = workbook.createCellStyle(); cellStyleTestHeader.setFont(font); cellStyleTestHeader.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.index); cellStyleTestHeader.setFillPattern(CellStyle.SOLID_FOREGROUND); // create timestamp cell style font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_NORMAL); font.setFontHeightInPoints((short) 10); cellStyleTimestamp = workbook.createCellStyle(); cellStyleTimestamp.setFont(font); cellStyleTimestamp.setDataFormat(workbook.createDataFormat().getFormat("yyyy-mm-dd hh:mm:ss")); cellStyleTimestamp.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create timestamp cell style font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_NORMAL); font.setFontHeightInPoints((short) 10); cellStyleTime = workbook.createCellStyle(); cellStyleTime.setFont(font); cellStyleTime.setDataFormat(workbook.createDataFormat().getFormat("hh:mm:ss")); cellStyleTime.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create success cell style font = workbook.createFont(); font.setColor(IndexedColors.DARK_GREEN.index); font.setBoldweight(Font.BOLDWEIGHT_NORMAL); font.setFontHeightInPoints((short) 10); cellStyleSuccess = workbook.createCellStyle(); cellStyleSuccess.setFont(font); cellStyleSuccess.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create ignore cell style font = workbook.createFont(); font.setColor(IndexedColors.BROWN.index); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setFontHeightInPoints((short) 10); cellStyleIgnore = workbook.createCellStyle(); cellStyleIgnore.setFont(font); cellStyleIgnore.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create warning cell style font = workbook.createFont(); font.setColor(IndexedColors.DARK_YELLOW.index); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setFontHeightInPoints((short) 10); cellStyleWarning = workbook.createCellStyle(); cellStyleWarning.setFont(font); cellStyleWarning.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create error cell style font = workbook.createFont(); font.setColor(IndexedColors.DARK_RED.index); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setFontHeightInPoints((short) 10); cellStyleError = workbook.createCellStyle(); cellStyleError.setFont(font); cellStyleError.setVerticalAlignment(CellStyle.VERTICAL_TOP); // create header cell style font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setFontHeightInPoints((short) 10); cellStyleHeader = (XSSFCellStyle) workbook.createCellStyle(); cellStyleHeader.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.index); cellStyleHeader.setFillPattern(CellStyle.SOLID_FOREGROUND); cellStyleHeader.setFont(font); }
From source file:packtest.WorkingWithFonts.java
License:Apache License
public static void main(String[] args) throws Exception { Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook(); Sheet sheet = wb.createSheet("Fonts"); Font font0 = wb.createFont(); font0.setColor(IndexedColors.BROWN.getIndex()); CellStyle style0 = wb.createCellStyle(); style0.setFont(font0);/*w w w . j a v a 2s. c om*/ Font font1 = wb.createFont(); font1.setFontHeightInPoints((short) 14); font1.setFontName("Courier New"); font1.setColor(IndexedColors.RED.getIndex()); CellStyle style1 = wb.createCellStyle(); style1.setFont(font1); Font font2 = wb.createFont(); font2.setFontHeightInPoints((short) 16); font2.setFontName("Arial"); font2.setColor(IndexedColors.GREEN.getIndex()); CellStyle style2 = wb.createCellStyle(); style2.setFont(font2); Font font3 = wb.createFont(); font3.setFontHeightInPoints((short) 18); font3.setFontName("Times New Roman"); font3.setColor(IndexedColors.LAVENDER.getIndex()); CellStyle style3 = wb.createCellStyle(); style3.setFont(font3); Font font4 = wb.createFont(); font4.setFontHeightInPoints((short) 18); font4.setFontName("Wingdings"); font4.setColor(IndexedColors.GOLD.getIndex()); CellStyle style4 = wb.createCellStyle(); style4.setFont(font4); Font font5 = wb.createFont(); font5.setFontName("Symbol"); CellStyle style5 = wb.createCellStyle(); style5.setFont(font5); Cell cell0 = sheet.createRow(0).createCell(1); cell0.setCellValue("Default"); cell0.setCellStyle(style0); Cell cell1 = sheet.createRow(1).createCell(1); cell1.setCellValue("Courier"); cell1.setCellStyle(style1); Cell cell2 = sheet.createRow(2).createCell(1); cell2.setCellValue("Arial"); cell2.setCellStyle(style2); Cell cell3 = sheet.createRow(3).createCell(1); cell3.setCellValue("Times New Roman"); cell3.setCellStyle(style3); Cell cell4 = sheet.createRow(4).createCell(1); cell4.setCellValue("Wingdings"); cell4.setCellStyle(style4); Cell cell5 = sheet.createRow(5).createCell(1); cell5.setCellValue("Symbol"); cell5.setCellStyle(style5); // Write the output to a file FileOutputStream fileOut = new FileOutputStream(Utils.getPath("xssf-fonts.xlsx")); wb.write(fileOut); fileOut.close(); }
From source file:poi.xssf.usermodel.examples.WorkingWithFonts.java
License:Apache License
public static void main(String[] args) throws Exception { Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook(); Sheet sheet = wb.createSheet("Fonts"); Font font0 = wb.createFont(); font0.setColor(IndexedColors.BROWN.getIndex()); CellStyle style0 = wb.createCellStyle(); style0.setFont(font0);/*from w ww . j ava 2s . c o m*/ Font font1 = wb.createFont(); font1.setFontHeightInPoints((short) 14); font1.setFontName("Courier New"); font1.setColor(IndexedColors.RED.getIndex()); CellStyle style1 = wb.createCellStyle(); style1.setFont(font1); Font font2 = wb.createFont(); font2.setFontHeightInPoints((short) 16); font2.setFontName("Arial"); font2.setColor(IndexedColors.GREEN.getIndex()); CellStyle style2 = wb.createCellStyle(); style2.setFont(font2); Font font3 = wb.createFont(); font3.setFontHeightInPoints((short) 18); font3.setFontName("Times New Roman"); font3.setColor(IndexedColors.LAVENDER.getIndex()); CellStyle style3 = wb.createCellStyle(); style3.setFont(font3); Font font4 = wb.createFont(); font4.setFontHeightInPoints((short) 18); font4.setFontName("Wingdings"); font4.setColor(IndexedColors.GOLD.getIndex()); CellStyle style4 = wb.createCellStyle(); style4.setFont(font4); Font font5 = wb.createFont(); font5.setFontName("Symbol"); CellStyle style5 = wb.createCellStyle(); style5.setFont(font5); Cell cell0 = sheet.createRow(0).createCell(1); cell0.setCellValue("Default"); cell0.setCellStyle(style0); Cell cell1 = sheet.createRow(1).createCell(1); cell1.setCellValue("Courier"); cell1.setCellStyle(style1); Cell cell2 = sheet.createRow(2).createCell(1); cell2.setCellValue("Arial"); cell2.setCellStyle(style2); Cell cell3 = sheet.createRow(3).createCell(1); cell3.setCellValue("Times New Roman"); cell3.setCellStyle(style3); Cell cell4 = sheet.createRow(4).createCell(1); cell4.setCellValue("Wingdings"); cell4.setCellStyle(style4); Cell cell5 = sheet.createRow(5).createCell(1); cell5.setCellValue("Symbol"); cell5.setCellStyle(style5); // Write the output to a file FileOutputStream fileOut = new FileOutputStream("xssf-fonts.xlsx"); wb.write(fileOut); fileOut.close(); }