简体   繁体   English

使用Java和WebDriver以Excel工作簿名称创建Excel工作表

[英]Creating Excel sheet with Excel workbook name using Java with webdriver

While creating excel file in output stream class, sheet is creating with Excel workbook name. 在输出流类中创建excel文件时,将使用Excel工作簿名称创建工作表。 The code I developed is as follows. 我开发的代码如下。 Please let me know the correct code to meet my requirement. 请让我知道正确的代码,以满足我的要求。

FileInputStream fi =new FileInputStream(System.getProperty("user.dir")+"\\src\\com\\ode\\resources\\Admin_Login.xls");
    Workbook wb = Workbook.getWorkbook(fi);
    Sheet sh = wb.getSheet("AdminUserLogin");
    Sheet sh1 = wb.getSheet("FieldValidations_Zip");
    System.out.println("<><><><><>   "+sh1.getName());

    //Create the Result xls file
    FileOutputStream fo = new FileOutputStream("Admin_Login_Results_"+cdate+".xls");
    //FileOutputStream fo = new FileOutputStream(System.getProperty("user.dir")+"\\src\\com\\ode\\resources\\output\\Admin_Login_Results_"+cdate+".xls");
    WritableWorkbook wwb = Workbook.createWorkbook(fo);
    WritableSheet ws = wwb.createSheet("FieldValidations_Zip", 0);
    Thread.sleep(Admin_zipcode);

Help will be appreciated!! 帮助将不胜感激!

我已经解决了这个问题,方法是将指针更改为其他工作表,然后对我来说效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM