- 浏览: 640176 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (314)
- 生活 (2)
- c# (37)
- 技术 (3)
- 400电话 (0)
- 400常见问题 (0)
- 400资费 (0)
- html (7)
- css (0)
- 数据库 (7)
- javascript (16)
- php (33)
- asp.net mvc2 (10)
- mysql (9)
- C# 3.0 LinQ (10)
- vs2005或vs2008 (4)
- flash and as3 (7)
- fms (1)
- dedeCMS (11)
- java (33)
- j2me (1)
- swing (1)
- c++ (1)
- jquery easyui (3)
- jquery (5)
- android (29)
- MongoDB (9)
- VtigerCRM (1)
- test (0)
- linux (30)
- nutch (2)
- SqlServer数据库 (2)
- 数据检索 (2)
- java抓取 (11)
- 乐天 (1)
- 淘宝 (1)
- Silverlight4.0 (6)
- sphinx实时索引 (5)
- ecshop (9)
- codeigniter(CI) (3)
- axure6 (1)
- 京东店铺装修教程 (2)
- xpath (1)
- joomla (2)
- bpm (1)
- Bootstrap (2)
- knockout (4)
- ecstore (4)
- css3 (1)
- 微信 (2)
- dede (0)
- soa_edi (1)
- odoo (0)
- web (1)
最新评论
-
骑着蜗牛超F1:
在ie6下报了个stack overflow at line ...
兼容ie6和ie7 的16进制码流在html中显示为图片代码(base64) -
冰之海洋:
好像少了一句代码吧? FloatingFunc.show(th ...
android 一直在最前面的浮动窗口效果 -
yanzhoupuzhang:
连接有问题!
iis7.0官方下载 IIS 7.0(微软Web服务器组件IIS 7.0) 官方(windows 2003,XP,2000) -
whatable:
唉,楼主你都没有搞清楚重量级和轻量级。。。。既然引用了SWT, ...
java swing 内置浏览器打开网页显示flash图表-swt Browser应用 -
yy_owen:
我晕啊,你链接的什么内容额,我要的iis,你链接个视频什么意思 ...
iis7.0官方下载 IIS 7.0(微软Web服务器组件IIS 7.0) 官方(windows 2003,XP,2000)
一、
概述
PHP-ExcelReader
是一个读取 Excel xsl
文件内容的一个 PHP
类。
它的下载网址:
http://sourceforge.net/projects/phpexcelreader/
本博客下载地址:phpExcelReader.zip
测试用Excel文件:测试.xls 文件名: phpExcelReader.zip
包含两个必需文件: oleread.inc
、 reader.php
。其它文件是一个应用例子 ,
自述文件等
二、
文件使用
首先 ,
包含 reader
类文件: require_once " reader.php";
新建一个实例: $xl_reader= new Spreadsheet_Excel_Reader ( );
设定编码信息: $xl_reader
->setOutputEncoding('utf-8');//不设定可能会是乱码
要和网页显示编码一致 读取 Excel
文件信息: $xl_reader->read("filename.xls");
它将导出 Excel
文件中所有可以识别的数据存储在一个对象中。数据存储在 2
个数组中,目前没有提供方法 /
函数访问这些数据 .
可以像下面这样简单的使用数组名。
sheets
数组包含了读取入对象的大量数据。它将导出 Excel
文件中所有可以识别的数据存储在一个 2
维数组中 $xl_reader->sheets[x][y]
。 x
为文档中的表序号, y
是以下的某个参数 :
①
numRows -- int --
表的行数
例如: $rows = $xl_reader->sheets[0]['numRows']
②
numCols -- int --
表的列数
例如: $cols = $xl_reader->sheets[0]['numCols']
③
cells -- array --
表的实际内容。是一个 [row][column]
格式的 2
维数组
例如: $cell_2_4 = $xl_reader->sheets[0]['cells'][2][4] //
行 2,
列 4
中的数据
④
cellsInfo -- array --
表格中不同数据类型的信息。每个都包含了表格的原始数据和类型。这个数组包含 2
部分: raw --
表格原始数据; type --
数据类型。
注:只显示非文本数据信息。
例如: $cell_info = $xl_reader[0]['cellsInfo'][2][4]
$cell_info['raw'] is the raw data from the cell
$cell_info['type'] is the data type
$xl_reader->sheets
数组示例:
Array ( [0] => Array ( [maxrow] => 0 [maxcol] => 0 [numRows] => 5 [numCols] => 3 [cells] => Array ( [1] => Array ( [1] => 网站名称 [2] => 网址 [3] => 类型 ) [2] => Array ( [1] => 百度 [2] => http://www.baidu.com [3] => 搜索引擎 ) [3] => Array ( [1] => 谷歌 [2] => http://www.google.com.hk [3] => 搜索引擎 ) [4] => Array ( [1] => 400电话 [2] => http://www.my400800.cn [3] => 企业网站 ) [5] => Array ( [1] => 新浪 [2] => http://www.sina.com.cn [3] => 门户网站 ) ) ) [1] => Array ( [maxrow] => 0 [maxcol] => 0 [numRows] => 0 [numCols] => 0 ) [2] => Array ( [maxrow] => 0 [maxcol] => 0 [numRows] => 0 [numCols] => 0 ) )
boundsheets
数组包含了对象的其它信息,数组按 workbook
索引。 第二个索引为名称: $xl_reader->boundsheets[i]['name']
返回第 i
个表的表名
例如: $sheetname = $xl_reader->boundsheets[0]['name']; // name of the first sheet
$xl_reader-> boundsheets
数组示例:
Array ( [0] => Array ( [name] => Sheet1 [offset] => 2148 ) [1] => Array ( [name] => Sheet2 [offset] => 3484 ) [2] => Array ( [name] => Sheet3 [offset] => 3760 ) )
PHP-ExcelReader
只能支持 BIFF7 ,BIFF8
格式的文件。包括 Excel95
到 Excel2003.
但是不包含 Excel5.0
及之前的版本 .
实际上 Excel XP
和 Excel 2003
使用的 BIFF8X
是 BIFF8
格式的一个扩展 .
所有添加的特性可能不被 PHP-ExcelReader.
锁支持。否则它只能以 Excel XP/2003
文件运行。
- phpExcelReader.zip (21 KB)
- 下载次数: 88
- 测试.rar (1.8 KB)
- 下载次数: 50
发表评论
-
phpredis 安装
2015-12-16 16:47 588phpredis是个人觉得最好的一个php-redis客户端, ... -
Memcache,Redis,MongoDB(数据缓存系统)方案对比与分析
2015-08-26 10:04 700一、问题: 数据库表数据 ... -
Ubuntu14.04安装 php及mysql
2015-08-18 11:17 1079①安装php: sudo apt-get install ... -
PHP swfupload图片文件上传实例代码
2015-05-18 11:34 716swfupload是一个flash插件它可以结合php来快 ... -
php 如何开启com组件?
2013-05-08 13:04 2220先到PHP.INI中打开COM选项,com.allow_d ... -
教大家如何利用PHP去修改word的内容
2013-05-02 09:24 1922今天给大家带来一个教程,教大家如何利用PHP去修改wo ... -
20130324
2013-03-24 22:36 0203 -
PHP检测函数所在的文件名
2013-01-20 12:56 996很简单的功能,用到PHP中的反射机制,具体使用的是Refl ... -
php 下载文件,中文乱码问题
2012-11-24 16:07 1265通过把Content-Type设置为application/o ... -
CKEditor图片上传功能开启方法
2012-03-15 17:12 1786PHP怎么给ckeditor编辑器加上传图片的功能? A ... -
不错的威盾PHP加密专家解密算法
2012-02-21 16:29 1207<?php <?php /********* ... -
在php中使用CKEDITOR在线编辑器
2012-01-30 16:55 2994一、官方Download 1、CKEditor ... -
c#连接mysql中文乱码解决方案(MySql.Data.dll)
2012-01-11 10:22 4641今天用C#类连接mysql数据库出现中文乱码具体解决方案如下: ... -
windows nginx php配置
2011-12-27 14:40 1528传说中nginx要比apache的负载均衡好的多,堪称神器 ... -
开源VtigerCRM的安装
2011-10-14 15:14 3541SugarCRM是一个好东西,04年刚刚发布 ... -
MongoDB的group分组操作
2011-09-15 15:11 2099先插入测试数据: for(var i=1; i<20; ... -
用php实现mongoDB的基本操作
2011-09-15 15:07 1317说到php连mongoDB,不得不先介绍一下php的官方手 ... -
用 nuSOAP解决传递对象数组的问题
2011-08-25 15:48 1527准备工作 首先定义一个类UserInfo:class ... -
PHP SOAP服务器端 C#客户端
2011-08-24 17:22 1349最近写了个PHP的SOAP服务器 端,实现了PHP客户端的调 ... -
php如何将图片gif,jpg或mysql longblob或blob字段值转换成16进制字符串!
2011-08-17 16:59 2022php如何将图片gif,jpg或mysql longblob或 ...
评论