
 I am using 2 excel sheets for reading and writing the data. Actually I want to send the results to a column. I am using MS Office 2010. I am struck up at the adding of Label. Please help. I got some error like extension/format. though I am using same 2010 office, while writing into a sheet, the previous data is removed, surprisingly!
I am using 2 excel sheets for reading and writing the data. Actually I want to send the results to a column. I am using MS Office 2010. I am struck up at the adding of Label. Please help. I got some error like extension/format. though I am using same 2010 office, while writing into a sheet, the previous data is removed, surprisingly!
String inFilePath = "D:\\PMC Automation\\Test Data with Queries.xls";
    FileInputStream inFile=new FileInputStream(inFilePath);
    Workbook W1=Workbook.getWorkbook(inFile);
    Sheet login_sheet=W1.getSheet("Login");
    Sheet countrysheet=W1.getSheet("Country");
    Sheet westsheet=W1.getSheet("WEST");
    String outFilePath = "D:\\PMC Automation\\Test Data with Queries
    with Results.xls";
    FileInputStream outFile=new FileInputStream(outFilePath);
    WritableWorkbook results=Workbook.createWorkbook(new File("D:\\PMC 
    Automation\\Test Data with Queries with Results.xls"));
    -----(statements)-----
   col++;
    for(int tui=0; tui<territorylist.size(); tui++)
    {
   allterritorylist.add
   (territorylist.get(tui).getAttribute("textContent"));
   if (westsheet.getCell(col, row).getContents().equalsIgnoreCase
   (territorylist.get(tui).getAttribute("textContent")))
            {
   System.out.println("\nTerritory " +westsheet.getCell
   (col, row).getContents()+ " existing in the Territory drop 
   down(UI)\n" );
   col++;
   //WritableSheet sheetwest=results.createSheet("mysheet", 0);
   WritableSheet sheetwest = results.getSheet("WEST");
   Label label= new Label(col, row, "PASS");
   sheetwest.addCell(label);
   col--;
   //Close Territory drop down
   driver.findElement(By.xpath("html/body/div[12]/div/ul/li[3]/a/span"))
   .click();
   Thread.sleep(300);
   }
