summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpshi2012-08-28 05:09:13 (EDT)
committer mwu2012-08-28 05:09:13 (EDT)
commitf7fb7e314818aa95251496f7bc2c8c94d34fd1c9 (patch)
tree56bd1ff30192c108cd72265cd9dd45eb663d9280
parent10055a50e106f1c424dc1958515891710aef9e1a (diff)
downloadorg.eclipse.birt-f7fb7e314818aa95251496f7bc2c8c94d34fd1c9.zip
org.eclipse.birt-f7fb7e314818aa95251496f7bc2c8c94d34fd1c9.tar.gz
org.eclipse.birt-f7fb7e314818aa95251496f7bc2c8c94d34fd1c9.tar.bz2
Fix 51561 Can't open excel data set if xls file contain formula "&"v201208281709
Description of issue: If the column referred in the formula is not a numeric, it will throw exception Resolution of issus: Only when the data type is numerical, do the dateFormatted case.
-rw-r--r--data/org.eclipse.birt.report.data.oda.excel/src/org/eclipse/birt/report/data/oda/excel/impl/util/ExcelFileReader.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/data/org.eclipse.birt.report.data.oda.excel/src/org/eclipse/birt/report/data/oda/excel/impl/util/ExcelFileReader.java b/data/org.eclipse.birt.report.data.oda.excel/src/org/eclipse/birt/report/data/oda/excel/impl/util/ExcelFileReader.java
index cb1585e..0eb79d5 100644
--- a/data/org.eclipse.birt.report.data.oda.excel/src/org/eclipse/birt/report/data/oda/excel/impl/util/ExcelFileReader.java
+++ b/data/org.eclipse.birt.report.data.oda.excel/src/org/eclipse/birt/report/data/oda/excel/impl/util/ExcelFileReader.java
@@ -290,21 +290,18 @@ public class ExcelFileReader {
private String resolveFormula(Cell cell) {
if (formulaEvaluator == null)
return cell.toString();
-
- if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell) ){
- //need to check for nulls
- //double myexdate = org.apache.poi.ss.usermodel.DateUtil.getExcelDate(cell.getDateCellValue());
- Date myjavadate = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(cell.getNumericCellValue());
- long millis = myjavadate.getTime();
- return Long.toString(millis);
-
- }
-
switch (formulaEvaluator.evaluateFormulaCell(cell)) {
case Cell.CELL_TYPE_BOOLEAN:
return ((Boolean) cell.getBooleanCellValue()).toString();
case Cell.CELL_TYPE_NUMERIC:
+ if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell) ){
+ //need to check for nulls
+ //double myexdate = org.apache.poi.ss.usermodel.DateUtil.getExcelDate(cell.getDateCellValue());
+ Date myjavadate = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(cell.getNumericCellValue());
+ long millis = myjavadate.getTime();
+ return Long.toString(millis);
+ }
return ((Double) cell.getNumericCellValue()).toString();
case Cell.CELL_TYPE_STRING: