0

这是我的代码

FileOutputStream exlFileName = new FileOutputStream(
        "D:\\Screenshot\\testExcel.xls");
WritableWorkbook exlWorkBook = Workbook.createWorkbook(exlFileName);
WritableSheet exlWorkSheet1 = exlWorkBook.createSheet(
        "Preload data check", 0);
Label Sheet1cellContent = new Label(0, 0, "LAST NAME");
Label Sheet1cellContent1 = new Label(1, 0, "FIRST NAME");
Label Sheet1cellContent2 = new Label(2, 0, "DOB");
Label Sheet1cellContent3 = new Label(3, 0, "GENDER");
Label Sheet1cellContent4 = new Label(4, 0, "ADMIT DATE AND TIME");
Label Sheet1cellContent5 = new Label(5, 0, "PROVIDER NAME");
Label Sheet1cellContent6 = new Label(6, 0, "BILL TYPE");
Label Sheet1cellContent7 = new Label(7, 0, "DOS DATE AND TIME");
exlWorkSheet1.addCell(Sheet1cellContent);
exlWorkSheet1.addCell(Sheet1cellContent1);
exlWorkSheet1.addCell(Sheet1cellContent2);
exlWorkSheet1.addCell(Sheet1cellContent3);
exlWorkSheet1.addCell(Sheet1cellContent4);
exlWorkSheet1.addCell(Sheet1cellContent5);
exlWorkSheet1.addCell(Sheet1cellContent6);
exlWorkSheet1.addCell(Sheet1cellContent7);
exlWorkBook.write();
/* Compare the DB value with front end values */

/* Last Name check */

String Last_Name = driver.findElement(By.id("txtPatinetLastName"))
        .getAttribute("value");

if (Last_Name.equals(Last)) {

    Label Sheet1cellContent_0 = new Label(0, 2, Last);
    exlWorkSheet1.addCell(Sheet1cellContent_0);
    exlWorkBook.write();
    exlWorkBook.close();
    System.out.println("Last Name " + Last + " is Correct ");
} else {
    System.out.println("Last Name " + Last + " is not correct ");
    Label Sheet1cellContent_0_error = new Label(0, 1, Last);
    exlWorkSheet1.addCell(Sheet1cellContent_0_error);
    exlWorkBook.write();
    exlWorkBook.close();
}

我在 excel 中将结果作为唯一的标题。姓氏、名字、出生日期、性别等在一行中。当我尝试在特定单元格中输入注入数据时,该值未显示。请帮我。提前致谢。

4

0 回答 0