diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index 108eb2836..c4b178111 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -21,8 +21,6 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\HttpFoundation\BinaryFileResponse; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -120,11 +118,10 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat $temp_file = sys_get_temp_dir().'/'.uniqid('export_').'.xlsx'; $writer->save($temp_file); - $response = new BinaryFileResponse($temp_file); - $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'export_duplicate.xlsx'); + $formatted = new FormattedExportGeneration(file_get_contents($temp_file), 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + unlink($temp_file); - return $response; + return $formatted; } public function getDescription(): string