@@ -357,19 +357,18 @@ public function setHtmlBlock($search, $htmlContent, $fullHtml = false): void
357
357
// Load the XML string into a SimpleXMLElement
358
358
$ xml = simplexml_load_string ($ documentXml );
359
359
// Extract content between <w:body> tags
360
- if ($ xml === false ){
360
+ if ($ xml === false ) {
361
361
return ;
362
362
}
363
363
$ bodyContent = $ xml ->xpath ('//w:body/* ' );
364
364
// Output the extracted content
365
365
$ documentBodyStr = '' ;
366
366
if ($ bodyContent ) {
367
- foreach ($ bodyContent as $ element ) {
368
- $ documentBodyStr .= $ element ->asXML ();
369
- }
367
+ foreach ($ bodyContent as $ element ) {
368
+ $ documentBodyStr .= $ element ->asXML ();
369
+ }
370
370
}
371
371
372
-
373
372
//replace html content r:id vaule avoid rid conflict
374
373
$ rIdsElement = $ xml ->xpath ('//*[@r:id] ' );
375
374
$ rIdValuesMap = [];
@@ -390,20 +389,20 @@ public function setHtmlBlock($search, $htmlContent, $fullHtml = false): void
390
389
$ this ->replaceXmlBlock ($ search , $ documentBodyStr , 'w:p ' );
391
390
392
391
$ xml = simplexml_load_string ($ relsDocumentXml );
393
- if ($ xml === false ){
392
+ if ($ xml === false ) {
394
393
return ;
395
394
}
396
395
// Register the namespace
397
396
$ xml ->registerXPathNamespace ('ns ' , 'http://schemas.openxmlformats.org/package/2006/relationships ' );
398
397
// Use XPath to find all Relationship nodes
399
398
$ RelationshipXmls = $ xml ->xpath ('//ns:Relationship ' );
400
399
$ RelationshipStr = '' ;
401
- if ($ RelationshipXmls ){
400
+ if ($ RelationshipXmls ) {
402
401
foreach ($ RelationshipXmls as $ relationshipXml ) {
403
402
$ rid = (string ) $ relationshipXml ->attributes ();
404
403
if (isset ($ rIdValuesMap [$ rid ])) {
405
404
$ tmpStr = $ relationshipXml ->asXML ();
406
- if ($ tmpStr!= false ){
405
+ if ($ tmpStr != false ) {
407
406
$ tmpStr = str_replace ($ rid , $ rIdValuesMap [$ rid ], $ tmpStr );
408
407
$ RelationshipStr .= $ tmpStr ;
409
408
}
0 commit comments