cancel
Showing results for 
Search instead for 
Did you mean: 

reg download to excel sheet

Former Member
0 Kudos

Hi

I have to download table contents to excel sheet for printing purpose,or is there any other facility through which we can directly print the table data?

please explain in detail.

thanks

prajakta

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello,

Try If the following code help you

//Take This is sample data in table with three records

String str[][]={{"One ","Hyd","MG","Manager"},{"Two","Chennai","ASM","AsstManager"},{"Three","Chennai","SREX","SrExecutive"},{"Four","Hyd","EX","Executive"}};

for(int i=0;i<str.length;i++)

{

String aa[]=str<i>;

byte b[]=aa[0].getBytes();

fos.write(b);

fos.write("\t".getBytes());

b=aa[1].getBytes();

fos.write(b);

fos.write("\t".getBytes());

b=aa[2].getBytes();

fos.write(b);

fos.write("\t".getBytes());

b=aa[3].getBytes();

fos.write(b);

fos.write("\t".getBytes());

fos.write("\n".getBytes());

}

// Find the URL of this File and bind to Context Using Following Code

FileInputStream fis = new FileInputStream(f);

FileChannel fc = fis.getChannel();

byte[] data = new byte[(int)(fc.size())];

ByteBuffer bb = ByteBuffer.wrap(data);

fc.read(bb);

IWDCachedWebResource objCachedWebResource = null;

if (data != null)

{

objCachedWebResource = WDWebResource.getWebResource(data,WDWebResourceType.XLS);

objCachedWebResource.setResourceName(f.getName());

}

wdContext.currentContextElement().setResource(objCachedWebResource.getAbsoluteURL());

Regards

LakshmiNarayanaChowdary.N

Former Member
0 Kudos

Hi Prajakta

You can use File Download UI Element for this. But first you will have to iterate through the data in the Table Node and convert it in to Spreadsheet ML format.

This file than can be downloaded on to your local system. Open the downloaded file in Excel and then print.

Regards,

Rahul

Former Member
0 Kudos

Hi,

Check this blog

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

Regards

Ayyapparaj

Former Member
0 Kudos

Hi

One 'PrintButton' UI element is available, through that you can directly print the whole data inside a view.

thanks

Smitha

Former Member
0 Kudos

Hi

Can u please tell me where can i find this Print Button

I am new to webdynpro please tell me in detail.

thanks

prajakta