【发布时间】:2015-10-20 06:25:59
【问题描述】:
我正在尝试在 excel 中写入数据。
FileOutputStream oFile = new FileOutputStream(yourFile, false);
HSSFWorkbook workbook=new HSSFWorkbook();
HSSFSheet sheet=workbook.createSheet("Script_ID");
HSSFRow rowheading =sheet.createRow(0); // throws exceptiom
rowheading.createCell(0).setCellValue(" XYZ");
rowheading.createCell(1).setCellValue("ABC");
相同的代码在 Selenium 中工作,但是当我在 IBM RFT 中尝试相同的代码时,它会在 createRow 中抛出 NullPointerException(如上所述)并且它没有创建名为“Script_ID”的新工作表。 所以无法在excel中写入任何数据。
任何人都可以建议我代码有什么问题或任何简单的方法在 excel 中写入数据,因为我必须在同一个 excel 文件下的多个工作表中的多行中迭代 2 列中的代码。
【问题讨论】:
标签: selenium automation rft spreadsheet-excel-writer