I have an option where a user can request that their data be merged to create a word document with a .docx extension. My program generates the document with no problem. When I try to download the document to the user it sends it to the browser instead. I added the DOCX information to file VVFXQ100 per the API document.
Here is my RPG code:
Here is the function on the browser end for the call to the server.
Thanks in advance.
Here is my RPG code:
Code:
// Send file to the browser vvOut.download='Y'; vvOut.file = %Char(Name) + '.docx'; vvout.contentType='DOCX'; vvout.binary='Y'; vvOut_file(NewDoc:vvOut);
Code:
function fnMerge(submit){ if (submit === true) { Ext.Ajax.request({ url: 'vvcall.pgm', params: { action: 'mergeDocument', pgm: 'PRMSPTLIST', PMID: currentRecord.data.PMID, PEID: Ext.getCmp('DOCUMENT').getValue() }, success: function(response){ var check = response.responseText; if (check) { var data = Ext.util.JSON.decode(response.responseText); if (data.SUCCESS == '1') { Ext.get('mergeWindow').switchOff({ duration: 1, callback: function(){ Ext.getCmp('mergeWindow').hide(); parent.showMessage('', '<b><center>Record Merged<\/b><\/center>'); } }); } else { Ext.getCmp(data.FLD).markInvalid(data.MSG); Ext.getCmp(data.FLD).focus(); } } }, failure: function(){ Ext.getBody().unmask(); Ext.Msg.alert('Failure', 'Failed to receive a response from server'); } }); } else { currentRecord = Ext.getCmp('mainPRMSPTLISTGrid').getSelectionModel().getSelected(); Ext.getCmp('mergeWindow').show(); } }
Comment