You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used TemplateProcessor to get my dotx file. and After getting the doc, I can't use the file generated in MS Word. When I try https://products.groupdocs.app/viewer/app, my file was opened and I've download it to pdf. Can PHPWORD make correct file for MS Word ???
try {
Settings::setOutputEscapingEnabled(true);
Settings::setCompatibility(false);
// Settings::setZipClass(Settings::PCLZIP);$template = newTemplateProcessor(public_path('assets/templates/regidoc1.dotx'));
$template->setMacroOpeningChars('{#');
$template->setMacroClosingChars('#}');
$nom1 = "FRANCIS";
$nom2 = "ISASI";
$nom3 = "LORD";
$tous = 'Tous à Kinshasa';
$to = 'DG REGIDESO';
$date = 'KIN 26/03.2024';
$ref = "Numéro de référence";
$objet = "Objet de la demande";
$body = "Ceci est le corps du document. Il peut contenir du texte enrichi, des images et des tableaux.";
$fonction = "Votre fonction";
$signataire = "Votre nom et votre signature";
$template->setValue('{Nom1}', str_replace('FRANCIS', '<span style="background-color: transparent;">FRANCIS</span>', $nom1));
$template->setValue('{Nom2}', $nom2);
$template->setValue('{Nom3}', $nom3);
$template->setValue('{Tous}', $tous);
$template->setValue('{To}', $to);
$template->setValue('{Date}', $date);
$template->setValue('{Ref}', $ref);
$template->setValue('{Objet}', $objet);
$template->setValue('{Body}', $body);
$template->setValue('{Fonction}', $fonction);
$template->setValue('{Signataire}', $signataire);
$filename = 'final.docx';
$template->saveAs($filename);
return response()->download($filename);
} catch (\Throwable$th) {
throw$th;
}
<?php
Expected Behavior
Want to get coorect file from TemplateProcessor
Current Behavior
Get Corrupted file after saveAs
Context
Please fill in your environment information:
PHP Version:8.2.17
PHPWord Version:1.2
The text was updated successfully, but these errors were encountered:
Describe the Bug
Get corrupted file after using TemplateProcessor.
Steps to Reproduce
I used TemplateProcessor to get my dotx file. and After getting the doc, I can't use the file generated in MS Word. When I try https://products.groupdocs.app/viewer/app, my file was opened and I've download it to pdf. Can PHPWORD make correct file for MS Word ???
Expected Behavior
Want to get coorect file from TemplateProcessor
Current Behavior
Get Corrupted file after saveAs
Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: