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

Free Support Forum - aspose.cloud

How to Merge Multiple Word Documents in PHP with Aspose.Words Cloud

I’ve been attempting to evaluate the Aspose Cloud family PHP SDK for manipulating MSWord docs and here is my experience so far (TL;DR: it’s bad).

The Append Multiple Word Documents sample code makes no sense:

  • It looks like it’s uploading sample.docx and then trying to append the same document to itself - and it doesn’t work.

  • If I change the $requestDocument filename and use a different $requestDocumentListDocumentEntries0 filename in my storage - it still doesn’t work and generates a PHP notice:
    PHP Notice: Undefined index: Content-Type in /workspace/aspose/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/ObjectSerializer.php on line 112 null

  • The API logs are of no help - there is no HH:MM:SS timestamp so I’m being forced to refresh and then open the latest log to see if the Request Start Date matches my latest API call

  • The API log Input data seems to have holes in it:
    Input Data: { "name": "" "path": "<redacted>" "storage": "" "extension": "" "type": "Docx" "header": "" "size": "11370" }
    I would have expected ‘name’ to have been set at least

  • The output data makes no sense either
    { "name":"" "path":"<redacted>" "storage":"" "extension":"" "type":"Docx" "header":"" "size":"11370" } { "name":"" "path":"<redacted>" "storage":"" "extension":"" "type":"Docx" "header":"" "size":"12654" }
    Why are there two objects? Again - it seems like name should match document names supplied in the API call - but the fields are empty.

Also, if this is JSON it’s incorrect it should be in the form: [{},{}].

Also, the sample code API call is returning a 200 status code - but it clearly isn’t working.

  • The files tab of the dashboard doesn’t list the time a document was changed making it difficult to see if any of my API calls have resulted in a change to one of the documents without downloading it and opening it.


Please use the following code to merge multiple Word documents in PHP with Aspose.Words Cloud SDK for PHP 22.3, it will resolve the issue. We will update the documentation soon. About date time in the log, please export the logs to the local drive it will include the timestamp with date and time.

Combine Two Word Documents in PHP



//TODO: Get your ClientId and ClientSecret at https://dashboard.aspose.cloud (free registration is required).


$wordsApi = new Aspose\Words\WordsApi($ClientId,$ClientSecret);

try {

	$remoteDataFolder = "Temp";
        $localFile = "data/02_pages.docx";
        $remoteFileName = "02_pages.docx";
	$localFile1 = "data/Test.docx";
        $remoteFileName1 = "Test.docx";
        $outputFileName = "TestAppendDocument.docx";

	$uploadRequest = new Aspose\Words\Model\Requests\UploadFileRequest($localFile,$remoteDataFolder."/".$remoteFileName,null);
	$uploadRequest1 = new Aspose\Words\Model\Requests\UploadFileRequest($localFile1,$remoteDataFolder."/".$remoteFileName1,null);

        $requestDocumentListDocumentEntries0 = new Aspose\Words\Model\DocumentEntry(array(
            "href" => $remoteDataFolder . "/" . $remoteFileName1,
            "import_format_mode" => "KeepSourceFormatting",
        $requestDocumentListDocumentEntries = [
        $requestDocumentList = new Aspose\Words\Model\DocumentEntryList(array(
            "document_entries" => $requestDocumentListDocumentEntries,
        $request = new Aspose\Words\Model\Requests\AppendDocumentRequest(
            $remoteDataFolder . "/" . $outputFileName,

        $result = $wordsApi->appendDocument($request);
	##Download file 
	$request = new Aspose\Words\Model\Requests\DownloadFileRequest($remoteDataFolder."/".$outputFileName,NULL,NULL);
	$result = $wordsApi->downloadFile($request);
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";