Index: s2-extension/src/test/java/org/seasar/extension/dataset/impl/XlsReaderTest.java =================================================================== --- s2-extension/src/test/java/org/seasar/extension/dataset/impl/XlsReaderTest.java (revision 2582) +++ s2-extension/src/test/java/org/seasar/extension/dataset/impl/XlsReaderTest.java (working copy) @@ -47,7 +47,7 @@ */ public void testSetupColumns() throws Exception { DataTable table = dataSet_.getTable(2); - assertEquals("1", 8, table.getColumnSize()); + assertEquals("1", 9, table.getColumnSize()); for (int i = 0; i < table.getColumnSize(); ++i) { assertEquals("2", "COLUMN" + i, table.getColumnName(i)); } @@ -59,6 +59,7 @@ assertEquals("8", ColumnTypes.BOOLEAN, table.getColumnType(5)); assertEquals("9", ColumnTypes.STRING, table.getColumnType(6)); assertEquals("10", ColumnTypes.STRING, table.getColumnType(7)); + assertEquals("11", ColumnTypes.BIGDECIMAL, table.getColumnType(8)); } /** @@ -100,6 +101,7 @@ assertEquals("6", Boolean.TRUE, row.getValue(5)); assertEquals("7", "\" \"", row.getValue(6)); assertEquals("8", "\"a\"b\"", row.getValue(7)); + assertNull("9", row.getValue(8)); } /** @@ -118,6 +120,8 @@ assertEquals("6", Boolean.TRUE, row.getValue(5)); assertEquals("7", " ", row.getValue(6)); assertEquals("8", "a\"b", row.getValue(7)); + assertEquals("8", "a\"b", row.getValue(7)); + assertNull("9", row.getValue(8)); } /** @@ -149,7 +153,7 @@ } /** - * + * */ public static class FloatingPointBean { private Double column0; Index: s2-extension/src/main/java/org/seasar/extension/dataset/impl/XlsReader.java =================================================================== --- s2-extension/src/main/java/org/seasar/extension/dataset/impl/XlsReader.java (revision 2582) +++ s2-extension/src/main/java/org/seasar/extension/dataset/impl/XlsReader.java (working copy) @@ -115,15 +115,17 @@ DataTable table = dataSet_.addTable(sheetName); int rowCount = sheet.getLastRowNum(); if (rowCount > 0) { - setupColumns(table, sheet.getRow(0), sheet.getRow(1)); + setupColumns(table, sheet); setupRows(table, sheet); } else if (rowCount == 0) { - setupColumns(table, sheet.getRow(0), null); + setupColumns(table, sheet); } return table; } - private void setupColumns(DataTable table, HSSFRow nameRow, HSSFRow valueRow) { + private void setupColumns(DataTable table, HSSFSheet sheet) { + HSSFRow nameRow = sheet.getRow(0); + HSSFRow valueRow = sheet.getRow(1); for (int i = 0;; ++i) { HSSFCell nameCell = nameRow.getCell((short) i); if (nameCell == null) { @@ -135,7 +137,12 @@ } HSSFCell valueCell = null; if (valueRow != null) { - valueCell = valueRow.getCell((short) i); + for (int j = 1; j <= sheet.getLastRowNum(); j++) { + valueCell = sheet.getRow(j).getCell((short) i); + if (valueCell != null) { + break; + } + } } if (valueCell != null) { table.addColumn(columnName, getColumnType(valueCell));