cancel
Showing results for 
Search instead for 
Did you mean: 

convert byte [] to resource

former_member187977
Participant
0 Kudos

hi,

I want to display a document in a dynpro view. The FileDownload UI element is bound with Resource type of an attribute.

The documents data that I get from the backend is a byte array for example bincon[]. how do I set this byte array in a resource type of attribute ?

basically, how to convert byte[] to resource ?

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member187977
Participant
0 Kudos

thanks!

former_member182372
Active Contributor
0 Kudos

		byte[] content = loadExceldata();
		IWDResource resource =  WDResourceFactory.createCachedResource(content, "employee" + System.currentTimeMillis() + ".xls", WDWebResourceType.XLS);
		wdContext.currentLocalVariablesElement().setResource(resource);

vijay_kumar49
Active Contributor
0 Kudos

Hi,

Please look at this document. This is having how to upload .XLS file through WDJAVA Application. Please look at this

[wiki|http://wiki.sdn.sap.com/wiki/display/WDJava/UploadingexcelfileusingWebDynproforJava] and [Document|http://wiki.sdn.sap.com/wiki/display/WDJava/Re-creatingtheFileObjectfromWebDynProFileUploadUIcontrol]

System.Text.Encoding enc = System.Text.Encoding.ASCII;
string myString = enc.GetString(myByteArray ); // where myByteArray is byte[]

Hope this is help full for u

Regards

Vijay

Edited by: VijaySAPEP on Nov 1, 2011 4:39 PM

former_member182598
Active Contributor
0 Kudos

Refer to this

Thanks

Prashant

Former Member
0 Kudos