How to create XLS sheet in webMethod

Hi All,
I need to develop a service to create xls sheet. Can anyone help me how to create excel sheet or if there is any java based API for xls in webMethod? I am using webMethod 6.1 version.

Hi,

You can use the java api for creating xls sheet.
Just paste the jar file in your package name folders\code\jars

Here is a sample:

File file = new File(“replicate/salvage/Packages_in_48036dd.xls”);
//file.createNewFile();
WritableWorkbook writableWorkbook = Workbook.createWorkbook(file);
WritableSheet writableSheet = writableWorkbook.createSheet(“packages”, 0);
Label label = new Label(0,0,“Package Names”);
writableSheet.addCell(label);
// writableWorkbook.write();

             Label temp;
            for(int i=1;i<fileList.length;i++)
            {
            int j=0;
            temp=new Label(0,i,fileList[i-1]);
	writableSheet.addCell(temp);
           // writableWorkbook.write();
            j++;
	}
            writableWorkbook.write();		
	writableWorkbook.close();

A simple GOOG search lead me to “http://poi.apache.org/spreadsheet/index.html”. By the way, why do you still use the 6.1? Does SAG still support it?

it worked for me, i am using 8.1