您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHPExcel的保存文件问题

2024/6/1 12:37:25发布29次查看
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);$objphpexcel->setactivesheetindex(0);$objphpexcel->getactivesheet()->setcellvalue('a1', 'hello1');$objphpexcel->getactivesheet()->setcellvalue('b1', 'world2');$objphpexcel->getactivesheet()->setcellvalue('c1', 'hello3');$objphpexcel->getactivesheet()->setcellvalue('d1', 'world4');$objphpexcel->getactivesheet()->settitle('sheet01');$objphpexcel->setactivesheetindex(0);$phpexcel = phpexcel_iofactory::load(phonelist.xls);$sheet = clone $phpexcel->getactivesheet();$objphpexcel->addexternalsheet($sheet);$objphpexcel->removesheetbyindex(0);$objphpexcel->getactivesheet()->removerow(3);$objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007');$objwriter->save(str_replace('.php', '.xlsx', __file__));// __file__ => excel文件的绝对路径?>
这段代码,我用php命令执行,可以创建一个后缀位xlsx的文件.但是如果我把这段代码放在带html标签的文件中然后用火狐浏览器打开.就无法创建,这是什么原因啊.修改过后的文件内容大致如下:
号码管理系统
>
姓名 :
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);
    $objphpexcel->setactivesheetindex(0);
    $objphpexcel->getactivesheet()->setcellvalue('a1', 'hello1');
    $objphpexcel->getactivesheet()->setcellvalue('b1', 'world2');
    $objphpexcel->getactivesheet()->setcellvalue('c1', 'hello3');
    $objphpexcel->getactivesheet()->setcellvalue('d1', 'world4');
    $objphpexcel->getactivesheet()->settitle('sheet01');
    $objphpexcel->setactivesheetindex(0);
$objwriter = phpexcel_iofactory::createwriter($objphpexcel, excel2007);
    $objwriter->save(str_replace('.php', '.xlsx', __file__));
}
?>
回复讨论(解决方案) 为什么要用 form包住代码?
把放到php代码前面看看。
为什么要用 form包住代码?
把放到php代码前面看看。
正愁找不到我的帖子呢.郁闷,csdn自己发的帖子都找不到.问题解决了.是权限问题.
http://blog.csdn.net/cp3alai/article/details/45665283
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product