資源描述:
《phpexcel中文幫助手冊》由會員上傳分享,免費在線閱讀,更多相關內容在行業(yè)資料-天天文庫。
1、phpExcel中文幫助手冊1、設置excel的屬性:創(chuàng)建人$objPHPExcel->getProperties()->setCreator("MaartenBalliauw");最后修改人$objPHPExcel->getProperties()->setLastModifiedBy("MaartenBalliauw");標題$objPHPExcel->getProperties()->setTitle("Office2007XLSXTestDocument");題目$objPHPExcel->getProperties()->setSubject
2、("Office2007XLSXTestDocument");描述$objPHPExcel->getProperties()->setDescription("TestdocumentforOffice2007XLSX,generatedusingPHPclasses.");關鍵字$objPHPExcel->getProperties()->setKeywords("office2007openxmlphp");種類$objPHPExcel->getProperties()->setCategory("Testresultfile");設置當前的she
3、et$objPHPExcel->setActiveSheetIndex(0);設置sheet的name$objPHPExcel->getActiveSheet()->setTitle('Simple');設置單元格的值復制代碼代碼示例:$objPHPExcel->getActiveSheet()->setCellValue('A1','String');$objPHPExcel->getActiveSheet()->setCellValue('A2',12);$objPHPExcel->getActiveSheet()->setCellValue('A
4、3',true);$objPHPExcel->getActiveSheet()->setCellValue('C5','=SUM(C2:C4)');$objPHPExcel->getActiveSheet()->setCellValue('B8','=MIN(B2:C5)');合并單元格復制代碼代碼示例:$objPHPExcel->getActiveSheet()->mergeCells('A18:E22');分離單元格復制代碼代碼示例:$objPHPExcel->getActiveSheet()->unmergeCells('A28:B28');保護
5、cell復制代碼代碼示例:$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);//Needstobesettotrueinordertoenableanyworksheetprotection!$objPHPExcel->getActiveSheet()->protectCells('A3:E13','PHPExcel');設置格式復制代碼代碼示例://Setcellnumberformatsechodate('H:i:s')."Setcellnumberformats";
6、$objPHPExcel->getActiveSheet()->getStyle('E4')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);$objPHPExcel->getActiveSheet()->duplicateStyle($objPHPExcel->getActiveSheet()->getStyle('E4'),'E5:E13');設置寬width復制代碼代碼示例://Setcolumnwidths$ob
7、jPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12);設置font復制代碼代碼示例:$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');$objPHPExcel->getActiveSheet()->getStyle('B1
8、')->getFont()->setSize(20);$objPHPExcel->getAct