本文整理汇总了PHP中PHPExcel::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel::setTitle方法的具体用法?PHP PHPExcel::setTitle怎么用?PHP PHPExcel::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel
的用法示例。
在下文中一共展示了PHPExcel::setTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PHPExcel
$objPHPExcel = new PHPExcel();
// Set document properties
/*$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");
$objPHPExcel->getProperties()->setKeywords("office 2007 openxml php");
$objPHPExcel->getProperties()->setCategory("Test result file");*/
// Add some data
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->setCellValue('A1', 'Hello');
$objPHPExcel->setCellValue('B2', 'world!');
$objPHPExcel->setCellValue('C1', 'Hello');
$objPHPExcel->setCellValue('D2', 'world!');
// Miscellaneous glyphs, UTF-8
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->setCellValue('A4', 'Miscellaneous glyphs');
$objPHPExcel->setCellValue('A5', '¨¦¨¤¨¨¨´a¨º?????¨¹???¨¹?');
// Rename worksheet
$objPHPExcel->getActiveSheet();
$objPHPExcel->setTitle('Simple');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a client¡¯s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;