cancel
Showing results for 
Search instead for 
Did you mean: 

File Download

david_fryda2
Participant
0 Kudos

Hi everyone,

I tried to create a File Download UI element.

Here is the code I wrote :

final IWDCachedWebResource resource = WDWebResource.getWebResource(content, WDWebResourceType.PDF);

IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow( resource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()),

resource.getResourceName());

window.open();

The problem is that it open 2 windows : the first is the window which asks to SAVE or to OPEN (which is OK), the second window is just an empty window (blank page).

How can I not display the second window ?

Thanks in advance.

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

former_member192434
Active Contributor
0 Kudos

Hi

This code is working file for me

wdComponentAPI.getMessageManager().reportSuccess("==Before =="+FilePath);

IWDResource res = WDResourceFactory.createResource(

new FileInputStream(FilePath"
"
wdContext.currentContextElement().getDirectory()

+wdContext.currentContextElement().getFileName()), wdContext.currentContextElement().getFileName(),

WDWebResourceType.DOC, true);

wdComponentAPI.getMessageManager().reportSuccess("=="+FilePath);

IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(

res.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()),

res.getResourceName());

window.show();

} catch (FileNotFoundException e) {

// ..

}

PS: May try to change window.open() to show()

Hople it will solve your problem

Thanks

Anup

david_fryda2
Participant
0 Kudos

Hi,

I tried the code but it still display an empty page just behind the little download modal window .

Maybe it is like this because of IE 7 ?

Thanks anyway!

Regards.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi David,

That blank window is a default window which opens up if you put FileDownloadBehaviour as ALLOW_SAVE. It has nothing to do with IE version. Try choosing AUTO or OPEN_INPLACE.

Hope it helps you.

david_fryda2
Participant
0 Kudos

Hi,

If I write FileDownloadBehaviour as AUTO or OPEN_INPLACE, it doesn't give me the choice to save the file. It displays it directly.

I still have the problem.

Thanks.

Regards.

Former Member
0 Kudos

Hi David,

As I can understand from your code you want a modal window to open up and then from that modal window the file should be downloaded....Is that corrcet?

If yes then for that write the code for getting the file resource and file download behaviour in the modal window.

Also the file download UI element should be on second window.

This should help you.

You can go through the follwoing PDF for uploading and downloading file:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a...

Former Member
0 Kudos

Hi,

You can refer this PDF for file download. This is working fine for me.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a...

I hope this may also help you.

thanx.

Edited by: saurav mago on Oct 27, 2008 6:06 AM