You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
869 B

require_once find_in_path('lib/Spout/Autoloader/autoload.php');
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
use Box\Spout\Common\Entity\Style\Color;
function trad_export_csv($trads) {
$entetes = array(
$defaultStyle = (new StyleBuilder())
$writer = WriterEntityFactory::createXLSXWriter(); // for XLSX files
$writer->openToBrowser('traduction.xlsx'); // stream data directly to the browser
$writer->addRow(WriterEntityFactory::createRowFromArray($entetes, $defaultStyle)); // add a row at a time
foreach ($trads as $trad) {
$writer->addRow(WriterEntityFactory::createRowFromArray($trad, $defaultStyle));