Issue 491 - fix off-by-one error in column counts

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2405 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2011-12-09 23:50:40 +00:00
parent b3bcb3361b
commit b409ef5670

View File

@ -174,7 +174,7 @@ public class ExcelImporter extends TabularImportingParserBase {
org.apache.poi.ss.usermodel.Row row = sheet.getRow(nextRow++); org.apache.poi.ss.usermodel.Row row = sheet.getRow(nextRow++);
if (row != null) { if (row != null) {
short lastCell = row.getLastCellNum(); short lastCell = row.getLastCellNum();
for (short cellIndex = 0; cellIndex <= lastCell; cellIndex++) { for (short cellIndex = 0; cellIndex < lastCell; cellIndex++) {
Cell cell = null; Cell cell = null;
org.apache.poi.ss.usermodel.Cell sourceCell = row.getCell(cellIndex); org.apache.poi.ss.usermodel.Cell sourceCell = row.getCell(cellIndex);
@ -219,6 +219,13 @@ public class ExcelImporter extends TabularImportingParserBase {
if (HSSFDateUtil.isCellDateFormatted(cell)) { if (HSSFDateUtil.isCellDateFormatted(cell)) {
value = HSSFDateUtil.getJavaDate(d); value = HSSFDateUtil.getJavaDate(d);
// TODO: If we had a time datatype, we could use something like the following
// to distinguish times from dates (although Excel doesn't really make the distinction)
// Another alternative would be to look for values < 0.60
// String format = cell.getCellStyle().getDataFormatString();
// if (!format.contains("d") && !format.contains("m") && !format.contains("y") ) {
// // It's just a time
// }
} else { } else {
value = d; value = d;
} }