Export to Excel

import java.io.FileOutputStream;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
public class Export_Excel {
public static String export() throws Exception
{
FileOutputStream fo=new FileOutputStream("D:\\Framework\\Results\\Result_export.xls");
WritableWorkbook wwb=Workbook.createWorkbook(fo);
WritableSheet ws=wwb.createSheet("Res", 0);
Label l=new Label(1,0,"ramesh");
Label l1=new Label(0,0,"reddy");
Label l2=new Label(2,3,"Duplicate");
Label l3=new Label(0,0,"oracle");
ws.addCell(l);
ws.addCell(l1);
ws.addCell(l2);
wwb.write();
wwb.close();

return "pass";
}
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
export() ;

}

}

2 comments:

  1. Its working. Thank You so much.

    ReplyDelete
  2. Thank you. Its working. I think ws.addCell(l3); must be added to print the string Oracle in the excel.

    ReplyDelete