From 4bf7fdaefd99bde6683b43088c6d6ffc6ad57b31 Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Fri, 15 Mar 2002 02:47:56 +0000 Subject: Applied patches from Loiec Lefeavre git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352216 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hssf/usermodel/TestCellStyle.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/testcases/org/apache/poi/hssf') 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(); -- cgit v1.2.3