无比风骚的PHPExcel,官方网站: http://www.codeplex.com/PHPExcel
导入导出都成,可以导出office2007格式,同时兼容2003。
下载下来的包中有文档和例子,大家可以自行研究。
抄段例子出来:
<?php
/**
* PHPExcel
*
* Copyright (C) 2006 - 2007 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2007 PHPExcel ( http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/lgpl.txt LGPL
* @version 1.5.0, 2007-10-23
*/
/** Error reporting */
error_reporting(E_ALL);
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');
/** PHPExcel */
include 'PHPExcel.php';
/** PHPExcel_Writer_Excel2007 */
include 'PHPExcel/Writer/Excel2007.php';
// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object/n";
$objPHPExcel = new PHPExcel();
// Set properties
echo date('H:i:s') . " Set properties/n";
$objPHPExcel->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()->setDescrīption("Test document for Office 2007 XLSX, generated usingphpclasses.");
$objPHPExcel->getProperties()->setKeywords("office 2007 openxmlphp");
$objPHPExcel->getProperties()->setCategory("Test result file");
// Add some data
echo date('H:i:s') . " Add some data/n";
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!');
$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!');
// Rename sheet
echo date('H:i:s') . " Rename sheet/n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format/n";
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
// Echo done
echo date('H:i:s') . " Done writing file./r/n";
相关推荐
PHP导出Excel (注:导出带图片的EXCEL也支持),已修正保存到本地不能打开已经乱码的问题,具体内容可参照文件中demo.php有详细说明。
php导出excel文件
php 导出 excel 类文件(包含使用实例)
php导出excel文件,csv,xls.
介绍一个php导出excel类,设置编码,标题栏,内容栏,页面编码,Excel文件的编码,生成并自动下载Excel,标题栏数组,内容数组。
php 导出excel php导入excel
后台php读取数据,提供PHP导出csv压缩包文件的表格,提供压缩打包下载
php导出excel文档,相关代码组建,已经测试通过了。可共学习使用。
php导出excel 一数组的方式 数组的形式导入excel
php根据excel模板导出excel并合并单元格,根据模板导出会少写很多样式的代码,非常方便
php导出excel实例 一个详细的导出excel2007实例
php导出excel表格,
PHP导出Excel ,已修正保存到本地不能打开已经乱码的问题,具体内容可参照文件中demo.php有详细说明。(注:无法导出图)——
[extjs]php导出excel组件及sql.zip 前台按钮+后台sql查询一应俱全 本文引用phpexcel组件,已附上.
PHP导出Excel表,可以自动的锁定excel表的下一列,插入整个表到excel中
PHP导出数据到excel,直接链接到MYSQL数据库
使用thinkphp导入导出excel数据
PHP导出EXCEL快速开发指南
php电子表格 导入/导出excel实例 php电子表格 导入/导出excel实例 php电子表格 导入/导出excel实例 php电子表格 导入/导出excel实例