cancel
Showing results for 
Search instead for 
Did you mean: 

Export to Excel

Former Member
0 Kudos

Hi,

I want to export the data of a table to an excel sheet on click of a button 'Export to Excel'.

I used the following,

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

I need two variations from what it generates:

1. The columns names appear as below

i.e. /NodeElement/AttributeName

I need the Field labels to be displayed as Column Names:

if I add the field labels while generating the XML, the Excel is not generated, throws an error.

2. The columns do not appear in the order in which I put them in the Arraylist, infact it takes the order of the context attributes.

Any suggestions on this???

I also tried using the following directions:

/people/subramanian.venkateswaran2/blog/2006/08/16/exporting-table-data-to-ms-excel-sheetenhanced-web-dynpro-binary-cache

but it throws an exception

java.lang.NoClassDefFoundError: jxl/format/CellFormat

I have added the jxl.jar file in the /lib folder under my project, also have included it as external jars in java build path.

Any suggestions if anything more needs to be done?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Shikha,

The problem is that the jxl.jar file is an external jar, and it hasn't been deployed into the portal, so in compilation time you get no errors but when you try to run it on the portal it can't find the jar file and then throws the exception, I have the same problem.

Has anyone solve this issue?

Former Member
0 Kudos

Hi,

In you LIB folder copy that JAR file Then It make sense.

And add external JAR Thru appliation properties.

We have done this and it works fine for us.

Thanks,

Lohi.

Former Member
0 Kudos

Hi Lohitha

Thanks for the quick answer, i have done exactly what you told me a couple of times, but is not working for me, i just have to add the jxl.jar file to the lib folder and then i just have to add the external jar to the project properties, but it doesn't work, maybe is configuration problem on Netweaver?

Former Member
0 Kudos

Hi again Lohitha

I just made another test, i created a new webdynpro project and made the procedure describe on the last reply and it worked! but my real project is a WebDynpro Development Component and if try to do the exact same procedure, it doesn't work.

Any sugestions?

Thanks in advance

Former Member
0 Kudos

Hi Luis and Shikha,

It is working for me. What I did was

First I had created a Library DC( by using Valery's Blog ) for jxl.jar ,then created two DCs, one for Excel export component and another for the root component which uses Excel export DC. In both of these DCs, I added the library in used components as well as in library reference.

So I think the for ur project to work, the jxl.jar should be deployed as a library in server( you will get one sda file for deploying from library project) and add a Library reference of that to your web dynpro project.

This is just my assumption.

Regards

Fahad Hamsa

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Luis and Shikha,

Fahad is Right, if u r using a DC for Web Dympro development then u need to create an external library DC project and use it.

For creating an external library u can refer to the following blogs:

/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro

and /people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas

For the mentioned problems of the field names and then the order of the columns:

The mentioned blog uses the method to convert XML to Excel...

If u use Excel 2003, and while opening the generated Excel u have to choose

option 1, then u will get a proper EXCEL with the field names and the order u give.

Another limitation of not using Excel 2003 is for all the columns with integer

contexts u will get an extra aggregate column in ur Excel.

Hope this helps.

Regards,

Alka

Message was edited by:

Alka Panday

Former Member
0 Kudos

hi Shikha

just chek that jar file has class CellFormat in proper packege

Thanks

Ninad