Hello,I put the code below in "row action event"The code works but the layout of the PDF file disappears.Thank you very much!
// Row Custom Action event
public function rowCustomAction($action, $row)
{
$leerling = ExecuteScalar("SELECT concat(famnaam_ll,' ',voornaam_ll) FROM stageovereenkomsten WHERE ID_stage = '".$row'idstage']."'");
$file = 'evaluatie '.$leerling.' '.$row['datum'].' door '.$currentuser.'.docx';
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('./uploads/templates/evaluatieblad.docx');
$schooljaar = ExecuteScalar("SELECT schooljaar FROM afdruk WHERE ID_stage = '".$row['idstage']."'");
$bedrijf = ExecuteScalar("SELECT bedrijf_naam FROM afdruk WHERE ID_stage = '".$row['idstage']."'");
$logo = ExecuteScalar("SELECT bedrijfslogo FROM afdruk WHERE ID_stage = '".$row['idstage']."'");
$templateProcessor->setValue('schooljaar', $schooljaar);
setlocale(LC_ALL, array('nl_NL.UTF-8','nl_NL@euro','nl_NL','dutch'));
$templateProcessor->setValue('datum', strftime('%A %d %b %Y', strtotime($row['datum'])));
$templateProcessor->setValue('bedrijf', $bedrijf);
$templateProcessor->setValue('naamll', $leerling);
$templateProcessor->setValue('klas', $row['klas']);
//$templateProcessor->saveAs('php://output');
$templateProcessor->saveAs('/temp/test.docx');
\PhpOffice\PhpWord\Settings::setPdfRendererPath('./vendor/hvkstore/dompdf');
\PhpOffice\PhpWord\Settings::setPdfRendererName('DOMPDF');
$phpWord = \PhpOffice\PhpWord\IOFactory::load('c:/temp/test.docx');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'PDF');
$xmlWriter->save('php://output');
$xmlWriter->save('c:/temp/test.pdf');
}