diff --git a/src/java/org/apache/poi/hssf/model/Workbook.java b/src/java/org/apache/poi/hssf/model/Workbook.java index 2aa2f1c4b8..143d6e7825 100644 --- a/src/java/org/apache/poi/hssf/model/Workbook.java +++ b/src/java/org/apache/poi/hssf/model/Workbook.java @@ -1832,6 +1832,14 @@ public class Workbook { return -1; } + /** + * Returns the list of FormatRecords in the workbook. + * @return ArrayList of FormatRecords in the notebook + */ + public ArrayList getFormats() { + return formats; + } + /** * Creates a FormatRecord, inserts it, and returns the index code. * @param format the format string diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index 0f968c2f07..cd827928a6 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -286,7 +286,7 @@ public class HSSFCellStyle } /** - * set the data format (only builtin formats are supported) + * set the data format (must be a valid format) * @see org.apache.poi.hssf.usermodel.HSSFDataFormat */ @@ -296,7 +296,7 @@ public class HSSFCellStyle } /** - * get the index of the built in format + * get the index of the format * @see org.apache.poi.hssf.usermodel.HSSFDataFormat */ diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java b/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java index 6cdb2cfa81..ba514eb1ee 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java @@ -276,7 +276,7 @@ public class HSSFDataFormat if (movedBuiltins) return ( String ) formats.get(index); else - return (String) (builtinFormats.get(index) != null ? builtinFormats.get(index) : formats.get(index)); + return (String) (builtinFormats.size() > index && builtinFormats.get(index) != null ? builtinFormats.get(index) : formats.get(index)); } /**