PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.4k stars 3.48k forks source link

Ajax or Async export #1901

Open jaures-kano opened 3 years ago

jaures-kano commented 3 years ago

I have some problems with async export , i don't want to load the page to download excell file how can i done this ?

my exportation code that work fine when i loading the page

        $streamedResponse->setCallback(function () use ($spreadsheet) {
            // $spreadsheet = //create you spreadsheet here;
            $writer = new Xlsx($spreadsheet);
            $writer->save('php://output');
        });

        $streamedResponse->setStatusCode(200);
        $streamedResponse->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        $streamedResponse->headers->set('Content-Disposition', 'attachment; filename=' . $name . '.xlsx');
        return $streamedResponse->send();

i work with symfony 5 and my front framework is React js latest version

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue for you, please try to help by debugging it further and sharing your results. Thank you for your contributions.