cancel
Showing results for 
Search instead for 
Did you mean: 

Read Excel file and populate in a Table

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member254270
Participant
0 Kudos

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

Answers (7)

Answers (7)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

As your rows and columns are uncertain, Try to work around to first check the cell value. If the value in the cell is not null then try to create table dynamically in WdmodifyView. The below links have complete step by step procedure to create table dynamically

[;

[;

Regards

Raghu

lokesh_kamana
Active Contributor
0 Kudos

Hi,

Go through this thread it will be usefull.

Thanks & Regards,

Lokesh

Former Member
0 Kudos

Thanks...

I just want the exact reverse of what you have said...

Read a Excel file and display in a Table

Krish

Former Member
0 Kudos

Help me in reading the content of the Excel file...

Former Member
0 Kudos

Hi Krish,

Please check this link

Kind regards

Sarsij

former_member192434
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

Use upload File UI element and after getting the data into Application populate the Node bound to the Table.

Regards,

Amit

Former Member
0 Kudos