cancel
Showing results for 
Search instead for 
Did you mean: 

How to Display the content of Excel file into Webdynpro Table

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi Experts

I am following the Blog to upload a file in to the webdynpro context,but my problem is after uploading a excel file i need to extract the content from that Excel file and that content should be displayed in the webdynpro table.Can any body please guide me how to read the content from excel and to Display in the Table.

Thanks and Regards

Kalyan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

Take for example, if Excel file contains 4 fields,

Add jxl.jar to JavaBuild path and Use this snippet

File f=new File("sample.xls");

Workbook w=Workbook.getWorkbook(f);

Sheet sh=w.getSheet(0);

int cols=sh.getColumns();

int rows=sh.getRows();

Cell c=null;

String s1=null;

String s2=null;

String s3=null;

String s4=null;

ArrayList al=new ArrayList();

int j=0;

for(int i=1;i<rows;i++)

{

ITableElement table=wdContext.createTableElementz

s1=sh.getCell(0,i).getContents();

s2=sh.getCell(1,i).getContents();

s3=sh.getCell(2,i).getContents();

s4=sh.getCell(3,i).getContents();

table.setName(s1);

table.setAddress(s2);

table.setDesignation(s3);

table.setDummy(s4);

al.add(j,table);

j++;

}

wdContext.nodeTable().bind(al);

Regards

LakshmiNarayana

Former Member
0 Kudos

Hi,

You can make use of POI from apache to do the reading of excel.

http://poi.apache.org/

other option is to make use of jxl http://jexcelapi.sourceforge.net/

Regards

Ayyapparaj