We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Mail Merge into a folder

Hi,

this question is also relevant to smartMarker.

Our procedure is as follows:

  1. Call Aspose to render a file (either MailMerge or smartMarker).

  2. According to the answer and wanted format download the file from Aspose.

  3. Delete the rendered file from Aspose.

We have a few cases where the thread is interrupted and thus the created files are not deleted.

We want to update our calls so that the rendered files will always reside in a specific folder.

In this way we can just delete the folder and create a new one if we have some issue with the deleting procedure.

This folder needs to be in a different location than the template.

How can We achieve that?

Thanks,

Yishay

Hi Yishayh,

There are two ways we can do this.

  1. Put /words/executeTemplate request accepts both Template file and Data file in request body and return Output file in API response. In this case rendered/output file will never store on Cloud Storage. cURL example will look as follows:
http://api.aspose.cloud/v1.1/words/executeTemplate?appSID=xxxx&signature=xxxx
-X PUT 
-F "file=@SampleExecuteTemplate.docx" \
-F "data=@Orders.xml" \
-H "Content-Type: multipart/form-data" 
-H "Accept: multipart/form-data"
  1. Post /words/{name}/executeTemplate API accepts a parameter named “filename”. Here we can specify path of rendered/output file on Cloud Storage. E.g. if we set filename parameter to Output/ExecutionResult.docx, API will save rendered/output file ExecutionResult.docx in Output folder. cURL example will look as follows:
curl -v "http://api.aspose.cloud/v1.1/words/SampleExecuteTemplate.docx/executeTemplate?fileName=Output/ExecutionResult.docx&appSid=xxxx&signature=xxxx" 
-d @Orders.xml 
-X POST 
-H "Content-Type: application/xml" 
-H "Accept: application/xml"

Please check Execute Mail Merge Templates article for more information.