permission($cmd_info["modulo_riferimento"],$_GET["codice_gara"],$id_modulo)) { $gara = gara::init($_GET["codice_gara"],$_GET["codice_round"]); if (!empty($gara)) { if (!empty($_GET["codice_lotto"])) { $gara->setLotto($_GET["codice_lotto"]); } else { $gara->setLotto($gara->getLotti()[0]["codice"]); } ob_start(); $gara->printCriteriaTable(); $table = ob_get_clean(); if (!empty($table)) { $reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); $spreadsheet = $reader->loadFromString($table); $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); $file_path = sys_get_temp_dir() . "/{$_SESSION["utente"]->codice}"; if (!is_dir($file_path)) { mkdir($file_path); } $file_path .= "/export.xls"; $writer->save($file_path); $error = false; header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=export.xls"); //File name extension was wrong header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); readfile($file_path); } } } if ($error) { header('HTTP/1.0 400 Bad Request'); die(); } ?>