diff options
author | Andrew C. Oliver <acoliver@apache.org> | 2002-03-15 02:47:56 +0000 |
---|---|---|
committer | Andrew C. Oliver <acoliver@apache.org> | 2002-03-15 02:47:56 +0000 |
commit | 4bf7fdaefd99bde6683b43088c6d6ffc6ad57b31 (patch) | |
tree | bbf8e31c92c5d6da8e2e91157b7c13552e6b9b3f /src/testcases/org/apache/poi/hssf | |
parent | ac6d403a94c89adc14ce0cd23b8644a484fa0043 (diff) | |
download | poi-4bf7fdaefd99bde6683b43088c6d6ffc6ad57b31.tar.gz poi-4bf7fdaefd99bde6683b43088c6d6ffc6ad57b31.zip |
Applied patches from Loiec Lefeavre
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352216 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java b/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java index f7eb6a5162..04fa4c6584 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java @@ -135,7 +135,7 @@ public class TestCellStyle } /** - * Tests that is creating a file with a date works correctly. + * Tests that is creating a file with a date or an calendar works correctly. */ public void testDataStyle() throws Exception @@ -147,10 +147,21 @@ public class TestCellStyle HSSFSheet s = wb.createSheet(); HSSFCellStyle cs = wb.createCellStyle(); HSSFRow row = s.createRow((short)0); + + // with Date: HSSFCell cell = row.createCell((short)1); cs.setDataFormat(HSSFDataFormat.getFormat("m/d/yy")); cell.setCellStyle(cs); cell.setCellValue(new Date()); + + // with Calendar: + cell = row.createCell((short)2); + cs.setDataFormat(HSSFDataFormat.getFormat("m/d/yy")); + cell.setCellStyle(cs); + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cell.setCellValue(cal); + wb.write(out); out.close(); |