PHPExcel 是用来操作Office Excel 文档的一个PHP类库,它基于微软的OpenXML标准和PHP语言。可以使用它来读取、写入不同格式的电子表格
导出类
PHPExcel类导出excel,同时对PHPExcel做了些精简处理,基本上可以满足数据导出excel的功能
代码如下:
代码如下 | 复制代码 |
//载入PHPExcel类 //创建一个excel对象实例 //设置文档基本属性 //设置当前的sheet索引,用于后续的内容操作。 //设置当前活动sheet的名称 //设置单元格内容www.111cn.net $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'b1'); $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'c1'); //输出文档 //设置header头部信息,并输出到浏览器 //保存至某一位置
|
导入excel的方法:
代码:
代码如下 | 复制代码 |
//载入PHPExcel类 $Obj = new PHPExcel_Reader_Excel5(); //读取demo.xls文件 //获取当前活动sheet //获取行数 //获取列数 //循环输出数据 www.111cn.net echo ' ';<br> print_r($data);<br> echo ''; |
但是这种方式有缺陷,老版本的excel有个数据上限,最多65536行数据,这时我们就无法通过excel来实现大数据的导出, 但我估计也没几个有这么我数据吧,当然如果有可以考虑使用csv来操作

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor