Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
What is this page about?
This page explains how to perform find-and-replace operations in PHP using Aspose.Words.
Find and Replace Example
PHP Code
$dataDir = '.';
$comHelper = new \COM("Aspose.Words.ComHelper");
$doc = $comHelper->Open($dataDir."/ReplaceSimple.doc");
// Check the text of the document
print "Original document text: " . $doc->Range->Text . PHP_EOL;
// Replace the text in the document.
$doc->Range->Replace("_CustomerName_", "James Bond", false, false);
// Check the replacement was made.
print "Original document text: " . $doc->Range->Text . PHP_EOL;
// Save the modified document.
$doc->Save($dataDir . "/ReplaceSimple Out.doc");
print "Text found and replaced successfully.\nFile saved at " . $dataDir . "ReplaceSimple Out.doc" . PHP_EOL;
Download Find and Replace Example (Aspose.Words) from any of the below mentioned social coding sites:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.