require_once 'PHPExcel.php'; $objPHPExcel = new PHPExcel(); // set default style for worksheet $style = $objPHPExcel->getDefaultStyle(); $style->getFont()->setName('Arial'); $style->getFont()->setSize(12); // add content to worksheet $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A1', 'Name') ->setCellValue('B1', 'Age') ->setCellValue('A2', 'John') ->setCellValue('B2', '25') ->setCellValue('A3', 'Mary') ->setCellValue('B3', '30'); // output Excel file header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="example.xlsx"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); exit;In this example, we create a new PHPExcel object and set the default style for the worksheet. We then add content to the worksheet and output the Excel file. The default font is set to Arial and font size is set to 12, but you can customize these settings to your needs. The PHPExcel library can be downloaded from GitHub or installed using Composer.