Hi @tilal.ahmad ,
Hope you are doing well.
I need your urgent input.
I have to update only certain characters of a run, how i can do that?
Below is the code and response data:
$requestDocument = “f2_1699257961.docx”;
$searchRequest = new SearchRequest(
$requestDocument, ‘ravi’, NULL, NULL, NULL, NULL, NULL);
$res = $wordsApi->search($searchRequest);
$res = ObjectSerializer::sanitizeForSerialization($res);
echo “
”;
print_r($res);
stdClass Object
(
[SearchingPattern] => ravi
[SearchResults] => stdClass Object
(
[ResultsList] => Array
(
[0] => stdClass Object
(
[RangeStart] => stdClass Object
(
[Node] => stdClass Object
(
[Text] => vestibulum gravida,
[NodeId] => 0.0.12.6
)
[Offset] => 13
)
[RangeEnd] => stdClass Object
(
[Node] => stdClass Object
(
[Text] => vestibulum gravida,
[NodeId] => 0.0.12.6
)
[Offset] => 17
)
)
[1] => stdClass Object
(
[RangeStart] => stdClass Object
(
[Node] => stdClass Object
(
[Text] => . In gravida et
[NodeId] => 0.0.20.158
)
[Offset] => 6
)
[RangeEnd] => stdClass Object
(
[Node] => stdClass Object
(
[Text] => . In gravida et
[NodeId] => 0.0.20.158
)
[Offset] => 10
)
)
)
)
[RequestId] => Root=1-654901f1-579db83c3d8f645043ef1c92
)
I’m using below code to update runs, but issue is that
it’s changing the color of whole run, not only a certail text like “ravi”.
$reqXmlColorDto = new XmlColor(array(“alpha” => 255,“web”=>“red”));
$requestFontDto = new Font(array(“bold”=>true,“color” => $reqXmlColorDto));
//$runUpdateReqData = new UpdateRunFontRequest($requestDocument, $paragraph_path, $index, $requestFontDto, null, null, null, null, null, $desDocument, null, null);
foreach($res->SearchResults->ResultsList as $key => $uData)
{
$mD = $uData->RangeStart->Node->NodeId;
$md = explode(‘.’,$mD);
$runUpdateReqData = new UpdateRunFontRequest($requestDocument, 'sections/'.$md[1].'/paragraphs/'.$md[2], $md[3], $requestFontDto, null, null, null, null, null, null, null, null);
$wordsApi->updateRunFont($runUpdateReqData);
}
Please let me know how i can update only the some text of a run using CURL. Thanks