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