cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Copying of Data From Excel file to Web Dynpro Java Table

Former Member
0 Kudos

Hi

Can any body give Suggestions that is how to copy or import Row and Column Values in the Excel file to the Java Web Dynpro Table

Regards

Chandran S

View Entire Topic
Former Member
0 Kudos

Hi,

First u should include jxl.jar API in ur classpath.

ind a Resource variable to FileUpload UI. Then from the Fileupload UI, u can get the Sheet variable as

InputStream fis=wdContext.currentFileUploadElement().getResource().read(true);

Workbook wb=Workbook.getWorkbook(fis);

Sheet sh=wb.getSheet(0);

This can be easily read to a table by

for(int i=14;i<34;i++)

{

String bId=sh.getCell(2,i).getContents();

String cId=sh.getCell(3,i).getContents();

String subj=sh.getCell(4,i).getContents();

IPrivate<View>.I<Table>Element el=wdContext.node<Table>().create<Table>Element();

wdContext.node<Table>().addElement(el);

el.setBID(bid);

el.setCID(cid);

el.setSUB(subj);

}

This example reads the excel from row 13 to 32 and column 3 to 5 and uploaded to a table

Regards

Fahad Hamsa