From 84d10b7ecd5956e5deaa1e9a10903c2921f97f46 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 12 Nov 2008 15:31:34 +0000 Subject: [PATCH] Fix bug #46184 - more odd escaped date formats git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@713403 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + src/java/org/apache/poi/ss/usermodel/DateUtil.java | 2 ++ .../org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java | 1 + 4 files changed, 5 insertions(+) diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index a641b9f4de..ff277d20dd 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 46184 - More odd escaped date formats Include the sheet number in the output of XLS2CSVmra 46043 - correctly write out HPSF properties with HWPF 45973 - added CreationHelper.createFormulaEvaluator(), implemeted both for HSSF and XSSF diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 803d9cd6ea..18922b442b 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 46184 - More odd escaped date formats Include the sheet number in the output of XLS2CSVmra 46043 - correctly write out HPSF properties with HWPF 45973 - added CreationHelper.createFormulaEvaluator(), implemeted both for HSSF and XSSF diff --git a/src/java/org/apache/poi/ss/usermodel/DateUtil.java b/src/java/org/apache/poi/ss/usermodel/DateUtil.java index aeeaa34617..90a7a5b509 100644 --- a/src/java/org/apache/poi/ss/usermodel/DateUtil.java +++ b/src/java/org/apache/poi/ss/usermodel/DateUtil.java @@ -211,6 +211,8 @@ public class DateUtil { fs = fs.replaceAll("\\\\-","-"); // And \, into , fs = fs.replaceAll("\\\\,",","); + // And \. into . + fs = fs.replaceAll("\\\\.","."); // And '\ ' into ' ' fs = fs.replaceAll("\\\\ "," "); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java index 9e451ee052..1d3941a02b 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java @@ -239,6 +239,7 @@ public final class TestHSSFDateUtil extends TestCase { "dd-mm-yy", "dd-mm-yyyy", "DD-MM-YY", "DD-mm-YYYY", "dd\\-mm\\-yy", // Sometimes escaped + "dd.mm.yyyy", "dd\\.mm\\.yyyy", // These crazy ones are valid "yyyy-mm-dd;@", "yyyy/mm/dd;@", -- 2.39.5