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

Free Support Forum - aspose.com

Rename file feature supports? Exception occurs during mail merge feature

  1. I can get a list of available files i.e.
    $folder = new Folder(); $tempStyleAll = $folder->GetFilesList("");
    But is it possible to rename a file using storage api?
  2. Template mail merge feature does not work with Sub-folder document file.
    Url: https://docs.aspose.cloud/words/mail-merge/

Source Code:

$xml = simplexml_load_file(getcwd() . “\template\Template.xml”); $mainDocument = “Business Templates//Marketing//Template.doc”; //create WordMailMerge object $doc = new WordMailMerge(); $result = $doc->ExecuteTemplate($mainDocument, $xml->asXML());

Exception Details

Fatal error: Uncaught exception ‘Exception’ with message ‘No file name specified’ in D:\Projects\AppServ\www\csbbdemo\Saaspose.SDK-for-PHP-master\Words\MailMerge.php:120 Stack trace: #0 D:\Projects\AppServ\www\csbbdemo\index.php(16): WordMailMerge->ExecuteTemplate(‘Business Templa…’, ‘<?xml version="…’) #1 {main} thrown in D:\Projects\AppServ\www\csbbdemo\Saaspose.SDK-for-PHP-master\Words\MailMerge.php

Submitted from: http://saaspose.com/


  1. Yes, it is possible. Please check the PHP REST example at https://docs.aspose.cloud/words/files-and-storage/#moving-a-file-to-a-new-location-in-cloud-storage

  2. Sorry, this was a bug with ExecuteTemplate method. Now this method has been updated to handle sub-folders. Please download latest SDK or MailMerge.php from https://github.com/aspose-words-cloud/aspose-words-cloud-php and update your code like the following:

$xml = simplexml_load_file(getcwd() . "\\template\\Template.xml");
$mainDocument = "Template.doc";
//create WordMailMerge object
$doc = new WordMailMerge();
$result = $doc->ExecuteTemplate($mainDocument, $xml->asXML(), "Business Templates/Marketing");

Note: Make sure “Template.doc” is uploaded in “Business Templates/Marketing” folder of the Saaspose storage.

Please feel free to contact us in case you have further comments or questions.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team


Did the last suggestion and code sample from our support team worked for you? Are you good to move forward with Saaspose API? If you need any further assistance, please do let us know. We'll be glad to help you.

Thanks & Regards
Shahzad Latif
Saaspose Support Team.