From 07772a2b16483d03a5471694a73368d47bfdacdc Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Fri, 6 Sep 2002 04:08:30 +0000 Subject: [PATCH] http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12349 PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352840 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/hssf/model/Workbook.java | 8 ++++++++ src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java | 4 ++-- .../org/apache/poi/hssf/usermodel/HSSFDataFormat.java | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) 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)); } /** -- 2.39.5