您好,欢迎访问一九零五行业门户网

使用PHPExcel导出文件_PHP教程

使用phpexcel导出文件 导出步骤
1.新建一个excel表格
实例化phpexcel类
2.创建sheet(内置表)
createsheet()
setactivesheetindex()
getactivesheet()
3.填充数据
setcellvalue()
4.保存文件
phpexcel_iofactory::createwriter()
save()
setactivesheetindex(0);$objsheet = $objphpexcel->getactivesheet(); //获得当前sheet$objsheet->settitle(demo); //给当前sheet设置名称$array = array( array(姓名,分数), array(李四,60), array(王五,70));$objsheet->setcellvalue(a5,姓名);$objsheet->setcellvalue(b5,分数); //给当前sheet填充数据$objsheet->setcellvalue(a6,张三);$objsheet->setcellvalue(b6,70);$objsheet->fromarray($array); //直接加载数据块填充数据$objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007'); //按照指定格式生成excel文件$objwriter->save(str_replace('.php', '.xls', __file__));
http://www.bkjia.com/phpjc/1047176.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/1047176.htmltecharticle使用phpexcel导出文件 导出步骤 1.新建一个excel表格 实例化phpexcel类 2.创建sheet(内置表) createsheet() setactivesheetindex() getactivesheet() 3.填充数据...
其它类似信息

推荐信息