on 12-02-2008 9:55 AM
Hi,
I have a requirement in which i have to read a Excel file and populate it thoroughly in a Table. The rows and column numbers are uncertain.
Help me on this...
Regards,
Krish
Hi,
I can give solution to Upload Excel file.
1)Add jxl jar folder in the lib folder of ur project.
2)Go to properties of ur project and add jar to ur project.
3)Using the File upload ui ,browse and upload the file.
4)Write the read file in to ur server location using fileoutput stream.
5)then using code u can read the excelfile from the server location itself.
Here is the code:
IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
fileuploaded = binaryType.getFileName();
byte b[] = wdContext.currentContextElement().getUpload();
File filename =new File("
<Server name>\<folde name>\" + fileuploaded);
try {
FileOutputStream out = new FileOutputStream(filename);
out.write(b);
out.close();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
int iRows = 0;
try {
Workbook wb = null;
Sheet sheet = null;
wb = Workbook.getWorkbook(filename);
sheet = wb.getSheet(0);
int iColumns = sheet.getColumns();
iRows = sheet.getRows();
int i = 0;
for (int r = 0; r < iRows; r++)
{
for (int c = 0; c < iColumns; c++)
{
Cell cell = sheet.getCell(c, r);
characterarray<i> = cell.getContents();
i++;
}
}
wb.close();
}
Declare Globally
//@@begin others
String fileuploaded;
IWDModifiableBinaryType binaryType;
String characterarray[] = new String [10];
//@@end
Thanks,
Durga Rao
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Please check this link
http://help.sap.com/erp2005_ehp_03/helpdata/EN/74/9184429069de54e10000000a155106/frameset.htm
Hope this link helpful for you
Regards
Ruturaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot experts...
A part of my problem got solved.
Now am facing problem in displaying the data in a table.
the xls file which i pick up may have any number of rows and columns, it is uncertain.
For which how to populate a table with dynamic rows and columns.
Need your help...
Regards,
Krish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks...
I just want the exact reverse of what you have said...
Read a Excel file and display in a Table
Krish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use upload File UI element and after getting the data into Application populate the Node bound to the Table.
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
May be of use https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0cc41cb-9576-2b10-99a6-ab90ef28...
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.