Hello,
The method createDocxAndDownload creates and downloads the DOCX but it doesn't remove the file. If you need to remove it after being created, we recommend you to use the function unlink (http://php.net/manual/en/function.unlink.php)
About downloading name, this method just calls createDocx to generate the document and uses these lines to download it:
header(
'Content-Type: application/vnd.openxmlformats-officedocument.' .
'wordprocessingml.document'
);
header(
'Content-Disposition: attachment; filename="' . $fileNameDownload .
'.' . $this->_extension . '"'
);
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($fileName . '.' . $this->_extension));
readfile($fileName . '.' . $this->_extension);
It's a generic method to download a DOCX. If it doesn't fit your needs or it's not working on your server (some server may require additional lines to download the DOCX properly), we recommend you to use the method createDocx directly and then download it using your code, for example setting a random name in this line:
header(
'Content-Disposition: attachment; filename="' . $fileNameDownload . '.' . $this->_extension . '"'
);
Regards.