cancel
Showing results for 
Search instead for 
Did you mean: 

Download excel File WITHOUT IWDLinkToURL

Former Member
0 Kudos

Good morning.

I need to open an excel file for the customer to open or save, as it is with a IWDLinkToURL, but I can not do it with a IWDLinkToURL by specifications of the application that I'm doing.

Consider the following code:

IWDCachedWebResource cachedExcelResource = null;

wdThis.wdGetReportesComponentsController excelXMLFile = (). ToExcel (DataNode, columnInfos, selectionElement). getBytes ("UTF-8");

cachedExcelResource = getCachedWebResource (excelXMLFile, fileName, WDWebResourceType.XLS)

Taking the object cachedExcelResource, how could deploy automatically?

I thought of the possibility of placing the object invisible and shoot IWDLinkToURL some onClick event, but I do not know how to manipulate objects of sight from the controller's view.

The other option is to set the onClick of IWDLinkToURL but I found its implementation.

Thank you very much!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can achieve this by using iframe UI element of WD.

Bind the URL of iframe to a context value attribute.Initially keep the iframe invisible, On required action : Set the attribute value to the url of cachedExcelResource and make the iframe visible.

Regards

Deepak

Former Member
0 Kudos

The source property of the IFrame is the URL of the resource created. By making the setter, change its visibility to true. The effect is that asks me to download the file in a popup in the top of the window. When I say yes only refreshes the current window without letting the file download.

What do I do? Thank you very much for your help.

Former Member
0 Kudos

check if the file is generated correctly.

try below code :


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

--logic to write data in file f----

FileInputStream excelCSVFile = new FileInputStream(f);
 cachedExcelResource=getCachedWebResource(
                                           excelCSVFile,  fileName,
	       	WDWebResourceType.getWebResourceType( "xls", "application/ms-excel"));


---- method---
 private IWDCachedWebResource getCachedWebResource(
		  InputStream file,
		  String name,
		  WDWebResourceType type)
	  {
		  IWDCachedWebResource cachedWebResource = null;

		  if (file != null)
		  {
			  cachedWebResource = WDWebResource.getWebResource(file, type);
			  cachedWebResource.setResourceName(name);
		  }
		  return cachedWebResource;
	  }

Regards

Deepak

Former Member
0 Kudos

Thank you very much!

I downloaded my file automatically.

Former Member
0 Kudos

Hi, i try with the CachedWebResource and work, but i will like to do it with the IWDResource and IWDResourceFactory, but i have the same problem I do not recognize it, if you found a solution please tell me.

Answers (1)

Answers (1)

Former Member
0 Kudos

Also regarding IWDResource interface, I do not recognize it. It gives me syntax error. Where should I include to use it?

The package is com.sap.tc.webdynpro.services.sal.datatransport.api IWDResource and IWDResourceFactory, but in this I get only the interfaces IWDInputMassDatasource and IWDOutputMassDatasource

Edited by: Daynet1840 on Feb 3, 2011 3:21 PM