- iamangel
- Posts : 2
Join date : 2012-11-08
how to write results in to the excel sheet using webdriver
Tue Nov 20, 2012 2:11 am
Hi friends,
i jus know who to extarct data from the excel sheets ...and i would like to know how to write results in to the xcel sheet..
i have googled and didnt found any info regarding that...so i posted here..hope someone finds the ri8 way
waiting for reply...
i jus know who to extarct data from the excel sheets ...and i would like to know how to write results in to the xcel sheet..
i have googled and didnt found any info regarding that...so i posted here..hope someone finds the ri8 way
waiting for reply...
- degaleesanp
- Posts : 5
Join date : 2013-01-19
Re: how to write results in to the excel sheet using webdriver
Sat Jan 19, 2013 8:56 pm
Hi iamangel,
Would you find the solution ??
Would you find the solution ??
- SunnyBoy
- Posts : 3
Join date : 2013-03-20
Re: how to write results in to the excel sheet using webdriver
Wed Mar 20, 2013 7:33 pm
Hi,
1st make sure you have jxl.jar file associated with your project[if your using add jar file to the project] and then
create Excel file as TestResults.xls
create functions as you want but here i named the function as fnUpdateResult and below is the code..
public static void UpdateResult(String Actual, String Value,String Result) throws BiffException, IOException, WriteException{
int SINo = 0;
Workbook workbook = Workbook.getWorkbook(new File(".\\TestResults.xls"));
WritableWorkbook copy = Workbook.createWorkbook(new File(".\\TestResults.xls"),workbook);
WritableSheet sheet2 = copy.getSheet("Sheet1");
int Row_Num = sheet2.getRows();
Label label3 = [size=9]new Label(1,Row_Num,Actual);
sheet2.addCell(label3);
Label label4 = new Label(2,Row_Num,Value);
sheet2.addCell(label4);
Label label5 = new Label(3,Row_Num,Result);
sheet2.addCell(label5);
}[size=9]catch(Exception e){
System.out.println(e); }
copy.write();
copy.close();
workbook.close();
}
[/size][/size]
Now you have the code to generate result
1st make sure you have jxl.jar file associated with your project[if your using add jar file to the project] and then
create Excel file as TestResults.xls
create functions as you want but here i named the function as fnUpdateResult and below is the code..
public static void UpdateResult(String Actual, String Value,String Result) throws BiffException, IOException, WriteException{
int SINo = 0;
Workbook workbook = Workbook.getWorkbook(new File(".\\TestResults.xls"));
WritableWorkbook copy = Workbook.createWorkbook(new File(".\\TestResults.xls"),workbook);
WritableSheet sheet2 = copy.getSheet("Sheet1");
int Row_Num = sheet2.getRows();
Label label3 = [size=9]new Label(1,Row_Num,Actual);
sheet2.addCell(label3);
Label label4 = new Label(2,Row_Num,Value);
sheet2.addCell(label4);
Label label5 = new Label(3,Row_Num,Result);
sheet2.addCell(label5);
}[size=9]catch(Exception e){
System.out.println(e); }
copy.write();
copy.close();
workbook.close();
}
[/size][/size]
Now you have the code to generate result
Permissions in this forum:
You cannot reply to topics in this forum