cancel
Showing results for 
Search instead for 
Did you mean: 

uploading excel

Former Member
0 Kudos

I've one LinkToAction named download the Excel templete.... So whenever i click to this link, particular excel sheet shoul open. I tired this but not coming to any result. So pls tell me how to do this.....

Thanks and Regards,

Amit Patil

Accepted Solutions (1)

Accepted Solutions (1)

snehal_kendre
Active Contributor
0 Kudos

Hi Amit,

If your excel template is fixed. i.e if there is only one excel template and you are able to put it in mimes folder then

you can use LinkToAction for your download.

simply fetch the excel from mimes as a url.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

String fileName = "ResourceAllocation" + ".xls";

IWDCachedWebResource cachedExcelResource = null;

File f = new File("ResourceAllocation.xls");

FileInputStream excelCSVFile = new FileInputStream(f);

IWDCachedWebResource cachedWebResource = null;

if (excelCSVFile!= null)

{

cachedWebResource = WDWebResource.getWebResource(excelCSVFile,WDWebResourceType.getWebResourceType("xls","application/ms-excel"));

cachedWebResource.setResourceName(fileName);

}//ends if.

cachedExcelResource =cachedWebResource;

wdContext.currentContextElement().setUrl(cachedExcelResource.getURL());

Hope this may help you.

Regards,

Deepak

nikhil_bose
Active Contributor
0 Kudos

once you get the resource, you can pretty well open it in new window.

use this code in onAction of LinkToAction


resource = WDResourceFactory.
                           createCachedResource(<byte[] data>, "Excel File", WDWebResourceType.XLS);

IWDWindow window = wdComponentAPI.getWindowManager()
.createNonModalExternalWindow(resource.getUrl(0),
selnode.getFileName());

window.show();

Please refer [TableUtilities.java|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3596] as an alternative.

nikhil

Former Member
0 Kudos
PradeepBondla
Active Contributor
0 Kudos
srinivas_sistu
Active Contributor
0 Kudos

Hi,

If you placed your XL Sheet in

srcmimes/components/your Component/XL Sheet

then,

Create an "Link to URL" UI element and make this UI element to point to below link...

url=WDURLGenerator.getAbsoluteWebResourceURL(

wdComponentAPI.getComponent().getDeployableObjectPart(),

"Your XL Sheet Name");

Regards,

Srinivas.

Former Member
0 Kudos

but can i use LinkToAction rather than url???? Please help...

Former Member
0 Kudos

Please answer me ASAP. It's urgent......