cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Upload / Download.

Former Member
0 Kudos

Hi,

I want to upload and download excel file using web dynpro for java. So, can any one provide me a tutorial which would guide me do the same.

Thanks & Regards,

Rahul

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Rahul

Check out this for using file upload & download UI element in 2004s

http://help.sap.com/saphelp_nw2004s/helpdata/en/42/fdf9c528d45171e10000000a1553f7/frameset.htm

Regards

Gauri

Former Member
0 Kudos

chk it

/people/subramanian.venkateswaran2/blog/2006/10/02/enhanced-file-upload--uploading-and-processing-excel-sheets

/people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api

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");

/** get the name of excel file and storing it in the server with the same name and extention****/

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) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

/**Readind from the server**/

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;

//get Cell contents by (COLUMN, ROW);

for (int r = 0; r < iRows; r++) {

for (int c = 0; c < iColumns; c++) {

Cell cell = sheet.getCell(c, r);

characterarray<i> = cell.getContents();

//wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);

i++;

}

}

wb.close();

Declare Globally

//@@begin others

String fileuploaded;

IWDModifiableBinaryType binaryType;

String characterarray[] = new String[1000];

//@@end

Former Member
0 Kudos

hi rahul

use this one

/people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities