From a98f5ac3948e39b593b5a13fa8ea1d143ace5949 Mon Sep 17 00:00:00 2001 From: Josh Micich Date: Wed, 16 Jul 2008 18:47:13 +0000 Subject: [PATCH] Patch 45410 - removed dependency on commons beanutils, collections and lang git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@677376 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 15 -- .../hssf/usermodel/contrib/HSSFCellUtil.java | 255 ++++++++++++++---- .../usermodel/contrib/HSSFRegionUtil.java | 68 ++--- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + 5 files changed, 228 insertions(+), 112 deletions(-) diff --git a/build.xml b/build.xml index b934555761..7eb02437a3 100644 --- a/build.xml +++ b/build.xml @@ -101,12 +101,6 @@ under the License. - - - - - - @@ -158,9 +152,6 @@ under the License. - - - @@ -270,9 +261,6 @@ under the License. - - - @@ -284,9 +272,6 @@ under the License. description="Fetches needed JAR files from the Internet"> - - - diff --git a/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFCellUtil.java b/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFCellUtil.java index 5e2cf1e0fe..67f4b38cb5 100644 --- a/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFCellUtil.java +++ b/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFCellUtil.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,20 +14,21 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.usermodel.contrib; -import org.apache.commons.beanutils.PropertyUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.exception.NestableException; -import org.apache.poi.hssf.usermodel.*; - import java.util.HashMap; -import java.util.Iterator; import java.util.Map; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFRichTextString; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + /** * Various utility functions that make working with a cells and rows easier. The various * methods that deal with style's allow you to create your HSSFCellStyles as you need them. @@ -39,12 +39,46 @@ import java.util.Map; * *@author Eric Pugh epugh@upstate.com */ - -public class HSSFCellUtil +public final class HSSFCellUtil { - private static HashMap unicodeMappings = new HashMap(); + public static final String ALIGNMENT = "alignment"; + public static final String BORDER_BOTTOM = "borderBottom"; + public static final String BORDER_LEFT = "borderLeft"; + public static final String BORDER_RIGHT = "borderRight"; + public static final String BORDER_TOP = "borderTop"; + public static final String BOTTOM_BORDER_COLOR = "bottomBorderColor"; + public static final String DATA_FORMAT = "dataFormat"; + public static final String FILL_BACKGROUND_COLOR = "fillBackgroundColor"; + public static final String FILL_FOREGROUND_COLOR = "fillForegroundColor"; + public static final String FILL_PATTERN = "fillPattern"; + public static final String FONT = "font"; + public static final String HIDDEN = "hidden"; + public static final String INDENTION = "indention"; + public static final String LEFT_BORDER_COLOR = "leftBorderColor"; + public static final String LOCKED = "locked"; + public static final String RIGHT_BORDER_COLOR = "rightBorderColor"; + public static final String ROTATION = "rotation"; + public static final String TOP_BORDER_COLOR = "topBorderColor"; + public static final String VERTICAL_ALIGNMENT = "verticalAlignment"; + public static final String WRAP_TEXT = "wrapText"; + + private static UnicodeMapping unicodeMappings[]; + + private static final class UnicodeMapping { + + public final String entityName; + public final String resolvedValue; + + public UnicodeMapping(String pEntityName, String pResolvedValue) { + entityName = "&" + pEntityName + ";"; + resolvedValue = pResolvedValue; + } + } + private HSSFCellUtil() { + // no instances of this class + } /** * Get a row from the spreadsheet, and create it if it doesn't exist. @@ -94,7 +128,6 @@ public class HSSFCellUtil * @param style If the style is not null, then set * @return A new HSSFCell */ - public static HSSFCell createCell( HSSFRow row, int column, String value, HSSFCellStyle style ) { HSSFCell cell = getCell( row, column ); @@ -129,13 +162,12 @@ public class HSSFCellUtil *@param cell the cell to set the alignment for *@param workbook The workbook that is being worked with. *@param align the column alignment to use. - *@exception NestableException Thrown if an error happens. * * @see HSSFCellStyle for alignment options */ - public static void setAlignment( HSSFCell cell, HSSFWorkbook workbook, short align ) throws NestableException + public static void setAlignment( HSSFCell cell, HSSFWorkbook workbook, short align ) { - setCellStyleProperty( cell, workbook, "alignment", new Short( align ) ); + setCellStyleProperty( cell, workbook, ALIGNMENT, new Short( align ) ); } /** @@ -144,18 +176,17 @@ public class HSSFCellUtil *@param cell the cell to set the alignment for *@param workbook The workbook that is being worked with. *@param font The HSSFFont that you want to set... - *@exception NestableException Thrown if an error happens. */ - public static void setFont( HSSFCell cell, HSSFWorkbook workbook, HSSFFont font ) throws NestableException + public static void setFont( HSSFCell cell, HSSFWorkbook workbook, HSSFFont font ) { - setCellStyleProperty( cell, workbook, "font", font ); + setCellStyleProperty( cell, workbook, FONT, font ); } /** * This method attempt to find an already existing HSSFCellStyle that matches * what you want the style to be. If it does not find the style, then it - * creates a new one. If it does create a new one, then it applyies the - * propertyName and propertyValue to the style. This is nessasary because + * creates a new one. If it does create a new one, then it applies the + * propertyName and propertyValue to the style. This is necessary because * Excel has an upper limit on the number of Styles that it supports. * *@param workbook The workbook that is being worked with. @@ -167,15 +198,11 @@ public class HSSFCellUtil *@exception NestableException Thrown if an error happens. */ public static void setCellStyleProperty( HSSFCell cell, HSSFWorkbook workbook, String propertyName, Object propertyValue ) - throws NestableException { - try - { HSSFCellStyle originalStyle = cell.getCellStyle(); HSSFCellStyle newStyle = null; - Map values = PropertyUtils.describe( originalStyle ); + Map values = getFormatProperties( originalStyle ); values.put( propertyName, propertyValue ); - values.remove( "index" ); // index seems like what index the cellstyle is in the list of styles for a workbook. // not good to compare on! @@ -184,8 +211,7 @@ public class HSSFCellUtil for ( short i = 0; i < numberCellStyles; i++ ) { HSSFCellStyle wbStyle = workbook.getCellStyleAt( i ); - Map wbStyleMap = PropertyUtils.describe( wbStyle ); - wbStyleMap.remove( "index" ); + Map wbStyleMap = getFormatProperties( wbStyle ); if ( wbStyleMap.equals( values ) ) { @@ -197,21 +223,131 @@ public class HSSFCellUtil if ( newStyle == null ) { newStyle = workbook.createCellStyle(); - newStyle.setFont( workbook.getFontAt( originalStyle.getFontIndex() ) ); - PropertyUtils.copyProperties( newStyle, originalStyle ); - PropertyUtils.setProperty( newStyle, propertyName, propertyValue ); + setFormatProperties( newStyle, workbook, values ); } cell.setCellStyle( newStyle ); + } + + /** + * Returns a map containing the format properties of the given cell style. + * + * @param style cell style + * @return map of format properties (String -> Object) + * @see #setFormatProperties(HSSFCellStyle, Map) + */ + private static Map getFormatProperties(HSSFCellStyle style) { + Map properties = new HashMap(); + putShort( properties, ALIGNMENT, style.getAlignment() ); + putShort( properties, BORDER_BOTTOM, style.getBorderBottom() ); + putShort( properties, BORDER_LEFT, style.getBorderLeft() ); + putShort( properties, BORDER_RIGHT, style.getBorderRight() ); + putShort( properties, BORDER_TOP, style.getBorderTop() ); + putShort( properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor() ); + putShort( properties, DATA_FORMAT, style.getDataFormat() ); + putShort( properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor() ); + putShort( properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor() ); + putShort( properties, FILL_PATTERN, style.getFillPattern() ); + putShort( properties, FONT, style.getFontIndex() ); + putBoolean( properties, HIDDEN, style.getHidden() ); + putShort( properties, INDENTION, style.getIndention() ); + putShort( properties, LEFT_BORDER_COLOR, style.getLeftBorderColor() ); + putBoolean( properties, LOCKED, style.getLocked() ); + putShort( properties, RIGHT_BORDER_COLOR, style.getRightBorderColor() ); + putShort( properties, ROTATION, style.getRotation() ); + putShort( properties, TOP_BORDER_COLOR, style.getTopBorderColor() ); + putShort( properties, VERTICAL_ALIGNMENT, style.getVerticalAlignment() ); + putBoolean( properties, WRAP_TEXT, style.getWrapText() ); + return properties; + } + + /** + * 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(HSSFCellStyle) + */ + private static void setFormatProperties( + HSSFCellStyle style, HSSFWorkbook workbook, Map properties) { + style.setAlignment( getShort( properties, ALIGNMENT ) ); + style.setBorderBottom( getShort( properties, BORDER_BOTTOM ) ); + style.setBorderLeft( getShort( properties, BORDER_LEFT ) ); + style.setBorderRight( getShort( properties, BORDER_RIGHT ) ); + style.setBorderTop( getShort( properties, BORDER_TOP ) ); + style.setBottomBorderColor( getShort( properties, BOTTOM_BORDER_COLOR ) ); + style.setDataFormat( getShort( properties, DATA_FORMAT ) ); + style.setFillBackgroundColor( getShort( properties, FILL_BACKGROUND_COLOR ) ); + style.setFillForegroundColor( getShort( properties, FILL_FOREGROUND_COLOR ) ); + style.setFillPattern( getShort( properties, FILL_PATTERN ) ); + style.setFont( workbook.getFontAt( getShort( 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.setVerticalAlignment( getShort( properties, VERTICAL_ALIGNMENT ) ); + style.setWrapText( getBoolean( properties, WRAP_TEXT ) ); + } + + /** + * Utility method that returns the named short value form the given map. + * Returns zero if the property does not exist, or is not a {@link Short}. + * + * @param properties map of named properties (String -> Object) + * @param name property name + * @return property value, or zero + */ + private static short getShort(Map properties, String name) { + Object value = properties.get( name ); + if ( value instanceof Short ) { + return ((Short) value).shortValue(); + } else { + return 0; } - catch ( Exception e ) - { - e.printStackTrace(); + } - throw new NestableException( "Couldn't setCellStyleProperty.", e ); + /** + * Utility method that returns the named boolean value form the given map. + * Returns false if the property does not exist, or is not a {@link Boolean}. + * + * @param properties map of properties (String -> Object) + * @param name property name + * @return property value, or false + */ + private static boolean getBoolean(Map properties, String name) { + Object value = properties.get( name ); + if ( value instanceof Boolean ) { + return ((Boolean) value).booleanValue(); + } else { + return false; } } + /** + * Utility method that puts the named short value to the given map. + * + * @param properties map of properties (String -> Object) + * @param name property name + * @param value property value + */ + private static void putShort(Map properties, String name, short value) { + properties.put( name, new Short( value ) ); + } + + /** + * Utility method that puts the named boolean value to the given map. + * + * @param properties map of properties (String -> Object) + * @param name property name + * @param value property value + */ + private static void putBoolean(Map properties, String name, boolean value) { + properties.put( name, new Boolean( value ) ); + } /** * Looks for text in the cell that should be unicode, like α and provides the @@ -225,42 +361,45 @@ public class HSSFCellUtil String s = cell.getRichStringCellValue().getString(); boolean foundUnicode = false; + String lowerCaseStr = s.toLowerCase(); - for ( Iterator i = unicodeMappings.entrySet().iterator(); i.hasNext(); ) - { - Map.Entry entry = (Map.Entry) i.next(); - String key = (String) entry.getKey(); - if ( s.toLowerCase().indexOf( key ) != -1 ) + for (int i = 0; i < unicodeMappings.length; i++) { + UnicodeMapping entry = unicodeMappings[i]; + String key = entry.entityName; + if ( lowerCaseStr.indexOf( key ) != -1 ) { - s = StringUtils.replace( s, key, "" + entry.getValue().toString() + "" ); + s = s.replaceAll(key, entry.resolvedValue); foundUnicode = true; } } if ( foundUnicode ) { - cell.setEncoding( HSSFCell.ENCODING_UTF_16 ); - cell.setCellValue( s ); + cell.setCellValue(new HSSFRichTextString(s)); } return cell; } - static { - unicodeMappings.put( "α", "\u03B1" ); - unicodeMappings.put( "β", "\u03B2" ); - unicodeMappings.put( "γ", "\u03B3" ); - unicodeMappings.put( "δ", "\u03B4" ); - unicodeMappings.put( "ε", "\u03B5" ); - unicodeMappings.put( "ζ", "\u03B6" ); - unicodeMappings.put( "η", "\u03B7" ); - unicodeMappings.put( "θ", "\u03B8" ); - unicodeMappings.put( "ι", "\u03B9" ); - unicodeMappings.put( "κ", "\u03BA" ); - unicodeMappings.put( "λ", "\u03BB" ); - unicodeMappings.put( "μ", "\u03BC" ); - unicodeMappings.put( "ν", "\u03BD" ); - unicodeMappings.put( "ξ", "\u03BE" ); - unicodeMappings.put( "ο", "\u03BF" ); + unicodeMappings = new UnicodeMapping[] { + um("alpha", "\u03B1" ), + um("beta", "\u03B2" ), + um("gamma", "\u03B3" ), + um("delta", "\u03B4" ), + um("epsilon", "\u03B5" ), + um("zeta", "\u03B6" ), + um("eta", "\u03B7" ), + um("theta", "\u03B8" ), + um("iota", "\u03B9" ), + um("kappa", "\u03BA" ), + um("lambda", "\u03BB" ), + um("mu", "\u03BC" ), + um("nu", "\u03BD" ), + um("xi", "\u03BE" ), + um("omicron", "\u03BF" ), + }; } + private static UnicodeMapping um(String entityName, String resolvedValue) { + return new UnicodeMapping(entityName, resolvedValue); + } } diff --git a/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFRegionUtil.java b/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFRegionUtil.java index f587f022fe..0a71600ed8 100644 --- a/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFRegionUtil.java +++ b/src/contrib/src/org/apache/poi/hssf/usermodel/contrib/HSSFRegionUtil.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.usermodel.contrib; @@ -26,33 +24,31 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.Region; -import org.apache.commons.lang.exception.NestableException; - /** * Various utility functions that make working with a region of cells easier. * *@author Eric Pugh epugh@upstate.com *@since July 29, 2002 */ - -public class HSSFRegionUtil +public final class HSSFRegionUtil { /** Constructor for the HSSFRegionUtil object */ - private HSSFRegionUtil() { } + private HSSFRegionUtil() { + // no instances of this class + } /** * Sets the left border for a region of cells by manipulating the cell style - * of the indidual cells on the left + * of the individual cells on the left * *@param border The new border *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed */ public static void setBorderLeft( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int rowStart = region.getRowFrom(); int rowEnd = region.getRowTo(); int column = region.getColumnFrom(); @@ -60,7 +56,8 @@ public class HSSFRegionUtil for ( int i = rowStart; i <= rowEnd; i++ ) { HSSFRow row = HSSFCellUtil.getRow( i, sheet ); HSSFCell cell = HSSFCellUtil.getCell( row, column ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderLeft", new Short( border ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.BORDER_LEFT, new Short( border ) ); } } @@ -71,11 +68,9 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed - * properly. */ public static void setLeftBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int rowStart = region.getRowFrom(); int rowEnd = region.getRowTo(); int column = region.getColumnFrom(); @@ -83,7 +78,8 @@ public class HSSFRegionUtil for ( int i = rowStart; i <= rowEnd; i++ ) { HSSFRow row = HSSFCellUtil.getRow( i, sheet ); HSSFCell cell = HSSFCellUtil.getCell( row, column ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "leftBorderColor", new Short( color ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.LEFT_BORDER_COLOR, new Short( color ) ); } } @@ -94,10 +90,9 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed */ public static void setBorderRight( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int rowStart = region.getRowFrom(); int rowEnd = region.getRowTo(); int column = region.getColumnTo(); @@ -106,7 +101,8 @@ public class HSSFRegionUtil HSSFRow row = HSSFCellUtil.getRow( i, sheet ); HSSFCell cell = HSSFCellUtil.getCell( row, column ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderRight", new Short( border ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.BORDER_RIGHT, new Short( border ) ); } } @@ -117,11 +113,9 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed - * properly. */ public static void setRightBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int rowStart = region.getRowFrom(); int rowEnd = region.getRowTo(); int column = region.getColumnTo(); @@ -129,7 +123,8 @@ public class HSSFRegionUtil for ( int i = rowStart; i <= rowEnd; i++ ) { HSSFRow row = HSSFCellUtil.getRow( i, sheet ); HSSFCell cell = HSSFCellUtil.getCell( row, column ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "rightBorderColor", new Short( color ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.RIGHT_BORDER_COLOR, new Short( color ) ); } } @@ -140,10 +135,9 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed */ public static void setBorderBottom( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int colStart = region.getColumnFrom(); int colEnd = region.getColumnTo(); int rowIndex = region.getRowTo(); @@ -151,7 +145,8 @@ public class HSSFRegionUtil for ( int i = colStart; i <= colEnd; i++ ) { HSSFCell cell = HSSFCellUtil.getCell( row, i ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderBottom", new Short( border ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.BORDER_BOTTOM, new Short( border ) ); } } @@ -162,22 +157,20 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed - * properly. */ public static void setBottomBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int colStart = region.getColumnFrom(); int colEnd = region.getColumnTo(); int rowIndex = region.getRowTo(); HSSFRow row = HSSFCellUtil.getRow( rowIndex, sheet ); for ( int i = colStart; i <= colEnd; i++ ) { HSSFCell cell = HSSFCellUtil.getCell( row, i ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "bottomBorderColor", new Short( color ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.BOTTOM_BORDER_COLOR, new Short( color ) ); } } - /** * Sets the borderBottom attribute of the HSSFRegionUtil object * @@ -185,10 +178,9 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed */ public static void setBorderTop( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int colStart = region.getColumnFrom(); int colEnd = region.getColumnTo(); int rowIndex = region.getRowFrom(); @@ -196,7 +188,8 @@ public class HSSFRegionUtil for ( int i = colStart; i <= colEnd; i++ ) { HSSFCell cell = HSSFCellUtil.getCell( row, i ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderTop", new Short( border ) ); + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.BORDER_TOP, new Short( border ) ); } } @@ -207,21 +200,18 @@ public class HSSFRegionUtil *@param region The region that should have the border *@param workbook The workbook that the region is on. *@param sheet The sheet that the region is on. - *@exception NestableException Thrown if the CellStyle can't be changed - * properly. */ public static void setTopBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook ) - throws NestableException { + { int colStart = region.getColumnFrom(); int colEnd = region.getColumnTo(); int rowIndex = region.getRowFrom(); HSSFRow row = HSSFCellUtil.getRow( rowIndex, sheet ); for ( int i = colStart; i <= colEnd; i++ ) { HSSFCell cell = HSSFCellUtil.getCell( row, i ); - HSSFCellUtil.setCellStyleProperty( cell, workbook, "topBorderColor", new Short( color ) ); - + HSSFCellUtil.setCellStyleProperty( + cell, workbook, HSSFCellUtil.TOP_BORDER_COLOR, new Short( color ) ); } } - } diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index a5cb00484c..3e37911e84 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 45410 - Removed dependency from contrib on commons beanutils,collections and lang New helper, HSSFOptimiser, which handles removing duplicated font and style records, to avoid going over the limits in Excel 45322 - Fixed NPE in HSSFSheet.autoSizeColumn() when cell number format was not found 45380 - Missing return keyword in ArrayPtg.toFormulaString() diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 27f0624314..511b570a2d 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 45410 - Removed dependency from contrib on commons beanutils,collections and lang New helper, HSSFOptimiser, which handles removing duplicated font and style records, to avoid going over the limits in Excel 45322 - Fixed NPE in HSSFSheet.autoSizeColumn() when cell number format was not found 45380 - Missing return keyword in ArrayPtg.toFormulaString() -- 2.39.5