diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 827ece0984..65819727dd 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -339,7 +339,13 @@ public function saveAs($fileName) unlink($fileName); } - rename($tempFileName, $fileName); + /* + * Note: we do not use ``rename`` funcion here, because it looses file ownership data on Windows, and the file may not open. + * + * @see https://github.com/PHPOffice/PHPWord/issues/532 + */ + copy($tempFileName, $fileName); + unlink($tempFileName); } /**