/** * Copies the entries in src to dest, using the preferential data type * so that maps can be compared for equality * * @param src the property map to copy from (read-only) * @param dest the property map to copy into * @since POI 3.15 beta 3 */ private static void putAll(final Map<String, Object> src, Map<String, Object> dest) { for (final String key : src.keySet()) { if (shortValues.contains(key)) { dest.put(key, getShort(src, key)); } else if (booleanValues.contains(key)) { dest.put(key, getBoolean(src, key)); } else if (borderTypeValues.contains(key)) { dest.put(key, getBorderStyle(src, key)); } else if (ALIGNMENT.equals(key)) { dest.put(key, getHorizontalAlignment(src, key)); } else if (VERTICAL_ALIGNMENT.equals(key)) { dest.put(key, getVerticalAlignment(src, key)); } else if (FILL_PATTERN.equals(key)) { dest.put(key, getFillPattern(src, key)); } else { if (log.check(POILogger.INFO)) { log.log(POILogger.INFO, "Ignoring unrecognized CellUtil format properties key: " + key); } } } }
/** * Sets the format properties of the given style based on the given map. * * @param style cell style * @param workbook parent workbook * @param properties map of format properties (String -> Object) * @see #getFormatProperties(CellStyle) */ private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) { style.setAlignment(getHorizontalAlignment(properties, ALIGNMENT)); style.setVerticalAlignment(getVerticalAlignment(properties, VERTICAL_ALIGNMENT)); style.setBorderBottom(getBorderStyle(properties, BORDER_BOTTOM)); style.setBorderLeft(getBorderStyle(properties, BORDER_LEFT)); style.setBorderRight(getBorderStyle(properties, BORDER_RIGHT)); style.setBorderTop(getBorderStyle(properties, BORDER_TOP)); style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR)); style.setDataFormat(getShort(properties, DATA_FORMAT)); style.setFillPattern(getFillPattern(properties, FILL_PATTERN)); style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR)); style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR)); style.setFont(workbook.getFontAt(getInt(properties, FONT))); style.setHidden(getBoolean(properties, HIDDEN)); style.setIndention(getShort(properties, INDENTION)); style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR)); style.setLocked(getBoolean(properties, LOCKED)); style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR)); style.setRotation(getShort(properties, ROTATION)); style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR)); style.setWrapText(getBoolean(properties, WRAP_TEXT)); }
/** * Copies the entries in src to dest, using the preferential data type * so that maps can be compared for equality * * @param src the property map to copy from (read-only) * @param dest the property map to copy into * @since POI 3.15 beta 3 */ private static void putAll(final Map<String, Object> src, Map<String, Object> dest) { for (final String key : src.keySet()) { if (shortValues.contains(key)) { dest.put(key, getShort(src, key)); } else if (booleanValues.contains(key)) { dest.put(key, getBoolean(src, key)); } else if (borderTypeValues.contains(key)) { dest.put(key, getBorderStyle(src, key)); } else if (ALIGNMENT.equals(key)) { dest.put(key, getHorizontalAlignment(src, key)); } else if (VERTICAL_ALIGNMENT.equals(key)) { dest.put(key, getVerticalAlignment(src, key)); } else if (FILL_PATTERN.equals(key)) { dest.put(key, getFillPattern(src, key)); } else { if (log.check(POILogger.INFO)) { log.log(POILogger.INFO, "Ignoring unrecognized CellUtil format properties key: " + key); } } } }
/** * Sets the format properties of the given style based on the given map. * * @param style cell style * @param workbook parent workbook * @param properties map of format properties (String -> Object) * @see #getFormatProperties(CellStyle) */ private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) { style.setAlignment(getHorizontalAlignment(properties, ALIGNMENT)); style.setVerticalAlignment(getVerticalAlignment(properties, VERTICAL_ALIGNMENT)); style.setBorderBottom(getBorderStyle(properties, BORDER_BOTTOM)); style.setBorderLeft(getBorderStyle(properties, BORDER_LEFT)); style.setBorderRight(getBorderStyle(properties, BORDER_RIGHT)); style.setBorderTop(getBorderStyle(properties, BORDER_TOP)); style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR)); style.setDataFormat(getShort(properties, DATA_FORMAT)); style.setFillPattern(getFillPattern(properties, FILL_PATTERN)); style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR)); style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR)); style.setFont(workbook.getFontAt(getInt(properties, FONT))); style.setHidden(getBoolean(properties, HIDDEN)); style.setIndention(getShort(properties, INDENTION)); style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR)); style.setLocked(getBoolean(properties, LOCKED)); style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR)); style.setRotation(getShort(properties, ROTATION)); style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR)); style.setWrapText(getBoolean(properties, WRAP_TEXT)); }