用java从excel中读取一行的多列?
我想阅读excel电子表格(.xlxs),其中包含testcases Premissions列/expected result列等等。如何读取特定行的多列。Everyrow(第一列)是一个测试用例名
我能读一行两列,但不确定如何读同一行的多列。我也不想在阅读时硬编码列#,行#。有什么建议吗
Map<String,String> arrayExcelData = new Hashtable<String,String>();
Iterator<Row> rowIterator = sheet.iterator();
while (rowIterator.hasNext())
{
Row row = rowIterator.next();
Cell methodNameCol = row.getCell(0);
Cell expectedResults = row.getCell(1);
if (expectedResults != null && methodNameCol !=null)
{
arrayExcelData.put(methodNameCol.getStringCellValue(),expectedResults.getStringCellValue());
}
workbook.close();
}
共 (0) 个答案