Tag: testng hssf

使用Apache POI和TestNG框架将数据写入excel

我正在尝试使用Apache POI将数据写入excel表单。我正在使用TestNG framerwork和eclipse IDE。 程序正在成功执行,没有任何错误。但是当我点击我的项目源的刷新,excel工作表不会来。 请告诉我,我将如何看到我生成的Excel表单。 我的代码如下: public class Test { public static void main(String args[]) { try { FileOutputStream fos = new FileOutputStream("User.xls"); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet worksheet = workbook.createSheet("worksheet"); HSSFRow row1 = worksheet.createRow((short) 0); HSSFCell cell1 = row1.createCell((short) 0); cell1.setCellValue("abc"); HSSFCell cell2 = row1.createCell((short) 1); cell2.setCellValue("123"); workbook.write(fos); fos.close(); } catch (FileNotFoundException […]