Question

1
Replies
985
Views
Close popover
Rajesh Srinivasulu (RajeshSrinu)
Accenture
Team Lead
Accenture
IN
RajeshSrinu Member since 2012 4 posts
Accenture
Posted: July 18, 2019
Last activity: September 3, 2019
Closed

SendFile API is not Working for Excel and PDF Formats

Hi,

We have a requirement, we get base 64 code of a Document from a service. based on the Filename we can identify the format of the File(Doc,xls,pdf).But when we use the Send file APi in a activity it works for Doc file but not for Excel and Pdf documents

Below is the code we used.

String rawres = (String) tools.getParameterPage().getParameterValue("DocumentContent");
String fileName = (String) tools.getParameterPage().getParameterValue("FileName");
byte[] byteArray=Base64Util.decodeToByteArray(rawres);
HashStringMap aMap = new HashStringMap();
aMap.put("ContentDisposition", "attachment;filename=\"" + fileName+ "\"");
aMap.put("ContentType", "application/force-download");
aMap.put("ContentType", "application/octet-stream");
aMap.put("ContentType", "application/download");
aMap.put( "contentType" ,"application/vnd.ms-excel");
String sErrorMessage = tools.sendFile( byteArray,fileName, false, aMap, true );

And also I tired by passing the Response page as a step page

String sErrorMessage = tools.sendFile(myStepPage, "FileSource", true, null, strFileName, false, null, true);

Appreciate you help.

***Edited by Moderator: Lochan to update platform capability tags***

Data Integration Java and Activities User Experience
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.