<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** Include PHPExcel */
require_once 'class/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("duchengjiu")
->setLastModifiedBy("duchengjiu")
->setTitle("Office 2007 XLSX userTable")
->setSubject("Office 2007 XLSX userTable")
->setDescription("Test userTable for Office 2007 XLSX.")
->setKeywords("office 2007")
->setCategory("userTable");
mysql_connect('localhost','root','root');
mysql_select_db('test');
$result = mysql_query("select * from user");
$i = 1;
while(list($id, $username, $password) = mysql_fetch_row($result)){
// Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A'.$i, $id)
->setCellValue('B'.$i, $username)
->setCellValue('C'.$i, $password);
$i++;
}
$objPHPExcel->getActiveSheet(0)->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
?>
分享到:
相关推荐
PHP开发中遇到的数据导入功能,发现此插件比较好用,实现代码见本人博客。PHPExcel Excel1.8导入导出。
php phpexcel 导出excel表格源码 亲测可用用的是phpexcel类
见到导出大量数据 自己定义Excel表格样式 用html当时定义见到导出大量数据 自己定义Excel表格样式 用html当时定义见到导出大量数据 自己定义Excel表格样式 用html当时定义见到导出大量数据 自己定义Excel表格样式 用...
主要为大家详细介绍了使用PHPExcel导出Excel表,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
使用PHPExcel导出Excel文件某些数据丢失做基于微信公众号的Web开发的时候,系统中可能会将用户的微信昵称存储下来,并且可能需要在导出的Excel文件中
phpexcel导出工作薄
设置表格字体颜色、数据格式、对齐方式、添加批注、合并拆分单元格、内容自适应、合并单元格、换行
php导出excel文档,相关代码组建,已经测试通过了。可共学习使用。
PHPExcel数据库表导出PHPExcel数据库表导出
引用phpexcel 导出带有背景颜色的excel,自定义背景颜色
phpexcel 操作excel 例子 边框。图片,颜色等等。开发需要可以看看
phpexcel 生成excel phpexcel 生成excel phpexcel 生成excel phpexcel 生成excel
本篇文章主要介绍了Yii2框架中使用PHPExcel导出Excel文件的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
php通过引用phpexcel扩展,导出多个工作表格,自定义每个工作表的头部标题
php电子表格 导入/导出excel实例 php电子表格 导入/导出excel实例 php电子表格 导入/导出excel实例 php电子表格 导入/导出excel实例
phpexcel生成excel类功能强大,适合多版本excel,希望对大家有所帮助,谢谢。
NULL 博文链接:https://zccst.iteye.com/blog/1233585
ThinkPHP实现数据导出为Excel文件的PHPExcel类库文件
phpexcel的导入导出,导入支持03 和 07 导入。导出有标准导出,html格式导出