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

php更新修改excel中的内容例子_PHP教程

代码如下
$dir = $document_root.'/backoffice/admin/oemcheck/';
$templatename = '1.xlsx';
$outputfilename = '模板.xlsx';
$txt='test';
//实例化excel读取类
$phpreader = new phpexcel_reader_excel2007();
if(!$phpreader->canread($dir.$templatename)){
 $phpreader = new phpexcel_reader_excel5();
 if(!$phpreader->canread($dir.$templatename)){
  echo '无法识别的excel文件!';
  return false;
 }
}
//读取excel
$phpexcel = $phpreader->load($dir.$templatename);
//读取工作表1
$currentsheet = $phpexcel->getsheet(0);
$currentsheet->setcellvalue('b13',iconv('gbk','utf-8',$txt));//表头赋值//
//实例化excel写入类www.111cn.net
$phpwriter = new phpexcel_writer_excel2007($phpexcel);
ob_start();
header(content-type: application/force-download);
header(content-type: application/octet-stream);
header(content-type: application/download);
header('content-disposition:attachment;filename=' .$outputfilename. '');//输出模板名称
header(content-transfer-encoding: binary);
header(last-modified:.gmdate(d, d m y h:i:s). gmt);
header('pragma: public');
header('expires: 30');
header('cache-control: public');
$phpwriter->save('php://output');
原文来自:http://www.111cn.net/phper/php/58174.htm你可能感兴趣的文章phpexcel 生成excel代码php 利用phpexcel生成excel文档实例phpexcel类从mysql中将数据导出到xls乱码phpexcel读取excel文档代码利用phpexcel读取excel实现代码phpexcel读写xls文件实现程序phpexcel导出excel文件时出现错误的解决办法phpexcel用法详细的介绍phpexcel数据内存溢出解决办法phpexcel的用法与简介
http://www.bkjia.com/phpjc/738531.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/738531.htmltecharticle代码如下 $dir = $document_root.'/backoffice/admin/oemcheck/'; $templatename = '1.xlsx'; $outputfilename = '模板.xlsx'; $txt='test'; //实例化excel读取类 $phpreader = new...
其它类似信息

推荐信息