on 05-30-2007 11:15 AM
Hi,
I have extracted the excel sheet data into my webdynpro application using HSSF.But now can anyone tell me how to extract the cell value one by one from the extracted content and map it to fields of my Webdynpro table???
Regards,
Priyanka
Hi,
Create a node with as many atirbutes the excel sheet's coulmns.
For each row of the excel create a new Node element and set all the values from excel. and add to node
Like:
INodeAElement dd = null;
for(i=0;i<excelRow.size;i++)
{
dd = wdContext.createNodeAElement();
dd.setCol1("asdas");
dd.setCol2("kksdas");
....
..
.....etc
wdContext.nodeNodeA().add(dd);
}
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi anoop
I am using HSSF api's to extract the content.I m able to extract it cell wise.Now can u help me out to know a simple way to populate cell content one by one into my webdynpro table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Priyanka,
If u r able to get the values cellwise from excel, then there is nothing to do to get the values in Tables.
I had used jxl api.I never used the API that u have mentioned, but even the logic remains same for all APIs.
The following program reads the values from column 1 to 4 for rows 15 to 34.
Just change the API specific methods
try
{
Sheet sh=wdContext.currentContextElement().getSheet();//GETTING A SHEET
for(int i=14;i<34;i++)
{
String colVal1=sh.getCell(2,i).getContents();//READING COLUMN1.ie.CELL VALUE
String colVal2=sh.getCell(3,i).getContents();//READING COLUMN2ie.CELL VALUE
String colVal3=sh.getCell(4,i).getContents();//READING COLUMN3ie.CELL VALUE
String colVal4=sh.getCell(5,i).getContents();//READING COLUMN4ie.CELL VALUE
IPrivate<View>.I<TableNode>Element ddEl=wdContext.node<TableNode>() .create<TableNode>Element();//CREATING TABLE ROW TO ENTER THE VALUES READ FROM EXCEL
wdContext.node<TableNode>() .addElement(ddEl);
ddEl.set<TableCol1>(colVal1);//SETTING COLUMN VALUE1 FOR FORM TABLE
ddEl.set<TableCol1>(colVal2);//SETTING COLUMN VALUE2 FOR FORM TABLE
ddEl.set<TableCol1>(colVal3);//SETTING COLUMN VALUE3 FOR FORM TABLE
ddEl.set<TableCol1>(colVal4);//SETTING COLUMN VALUE4 FOR FORM TABLE
}
}
catch(Exception e)
{
}
Hi,
Go through some nice blogs by Munna
/people/nagamohan.devisetty/blog/2006/07/31/reading-excel-sheet-from-java-without-using-any-framework
/people/nagamohan.devisetty/blog/2006/08/14/reading-multiple-sheets-of-excel-sheet-from-java
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.