I have an xlsx file with 4 Sheets. Using the code below I am able to export the first sheet only.
I want to be able to export any sheet by name to pdf.
Below is what I've done so far:
$export_file = 'export.pdf';
$import_file = './media/migration/import.xlsx';
$sheet_name = 'Menu_A';
$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
$rendererLibraryPath = '/var/www/public/vendor/mpdf/mpdf';
$object = PHPExcel_IOFactory::load($import_file);
$object->setActiveSheetIndexByName($sheet_name);
PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath);
$objWriter = PHPExcel_IOFactory::createWriter($object, 'PDF');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="' . $export_file . '"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)