Append Documents in PHP

Aspose.Words - Append Documents Example

Find and Replace Example

PHP Code

$dataDir = '.';
$comHelper = new \COM("Aspose.Words.ComHelper");

// Load the destination and source documents from disk.
$dstDoc = $comHelper->Open($dataDir."/TestFile.Destination.doc");
$srcDoc = $comHelper->Open($dataDir."/TestFile.Source.doc");

// Append the source document to the destination document while keeping the original formatting of the source document.
$dstDoc->AppendDocument($srcDoc,1);
$dstDoc->Save($dataDir . "/TestFile Out.docx");
echo "Document appended successfully.\nFile saved at " . $dataDir . "TestFile Out.docx" . PHP_EOL;

Download Running Code

Download Append Documents Example (Aspose.Words) from any of the below mentioned social coding sites: