Horje
php mail merge docx document Code Example
php mail merge docx document
<?php

include_once('tbszip.php');

$zip = new clsTbsZip();

// Open the first document
$zip->Open('doc1.docx');
$content1 = $zip->FileRead('word/document.xml');
$zip->Close();

// Extract the content of the first document
$p = strpos($content1, '<w:body');
if ($p===false) exit("Tag <w:body> not found in document 1.");
$p = strpos($content1, '>', $p);
$content1 = substr($content1, $p+1);
$p = strpos($content1, '</w:body>');
if ($p===false) exit("Tag </w:body> not found in document 1.");
$content1 = substr($content1, 0, $p);

// Insert into the second document
$zip->Open('doc2.docx');
$content2 = $zip->FileRead('word/document.xml');
$p = strpos($content2, '</w:body>');
if ($p===false) exit("Tag </w:body> not found in document 2.");
$content2 = substr_replace($content2, $content1, $p, 0);
$zip->FileReplace('word/document.xml', $content2, TBSZIP_STRING);

// Save the merge into a third file
$zip->Flush(TBSZIP_FILE, 'merge.docx');




Php

Related
tinker laravel 8 Code Example tinker laravel 8 Code Example
pass yield to vue component laravel Code Example pass yield to vue component laravel Code Example
php html text before first h2 tag Code Example php html text before first h2 tag Code Example
php return a json response Code Example php return a json response Code Example
find the next 7 date data in laravel eloquent Code Example find the next 7 date data in laravel eloquent Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7