当前位置: 网学 > 编程文档 > PHP > 正文

php编程实现获取excel文档内容的代码实例

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/22
mber'';
if (($xfindex == 0x9) || ($xfindex == 0xa)){
$this->multiplier = 100;
}
}else{
$this->curformat = $this->_defaultFormat;
$this->rectype = ''unknown'';
}
return false;
}
}
//}}}
//{{{ createDate()
/**
* Convert the raw Excel date into a human readable format
*
* Dates in Excel are stored as number of seconds from an epoch. On
* Windows, the epoch is 30/12/1899 and on Mac it''s 01/01/1904
*
* @access private
* @param integer The raw Excel value to convert
* @return array First element is the converted date, the second element is number a unix timestamp
*/
function createDate($numValue)
{
if ($numValue > 1) {
$utcDays = $numValue - ($this->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS);
$utcValue = round(($utcDays+1) * SPREADSHEET_EXCEL_READER_MSINADAY);
$string = date ($this->curformat, $utcValue);
$raw = $utcValue;
} else {
$raw = $numValue;
$hours = floor($numValue * 24);
$mins = floor($numValue * 24 * 60) - $hours * 60;
$secs = floor($numValue * SPREADSHEET_EXCEL_READER_MSINADAY) - $hours * 60 * 60 - $mins * 60;
$string = date ($this->curformat, mktime($hours, $mins, $secs));
}
return array($string, $raw);
}
function createNumber($spos)
{
$rknumhigh = $this->_GetInt4d($this->data, $spos + 10);
$rknumlow = $this->_GetInt4d($this->data, $spos + 6);
//for ($i=0; $i<8; $i++) { echo ord($this->data[$i+$spos+6]) . " "; } echo "<br>";
$sign = ($rknumhigh & 0x80000000) >> 31;
$exp = ($rknumhigh & 0x7ff00000) >> 20;
$mantissa = (0x100000 | ($rknumhigh & 0x000fffff));
$mantissalow1 = ($rknumlow & 0x80000000) >> 31;
$mantissalow2 = ($rknumlow & 0x7fffffff);
$value = $mantissa / pow( 2 , (20- ($exp - 1023)));
if ($mantissalow1 != 0) $value += 1 / pow (2 , (21 - ($exp - 1023)));
$value += $mantissalow2 / pow (2 , (52 - ($exp - 1023)));
//echo "Sign = $sign, Exp = $exp, mantissahighx = $mantissa, mantissalow1 = $mantissalow1, mantissalow2 = $mantissalow2<br>n";
if ($sign) {$value = -1 * $value;}
return $value;
}
function addcell($row, $col, $string, $raw = '''')
{
//echo "ADD cel $row-$col $stringn";
$this->sheets[$this->sn][''maxrow''] = max($this->sheets[$this->sn][''maxrow''], $row + $this->_rowoffset);
$this->sheets[$this->sn][''maxcol''] = max($this->sheets[$this->sn][''maxcol''], $col + $this->_coloffset);
$this->sheets[$this->sn][''cells''][$row + $this->_rowoffset][$col + $this->_coloffset] = $string;
if ($raw)
$this->sheets[$this->sn][''cellsInfo''][$row + $this->_rowoffset][$col + $this->_coloffset][''raw''] = $raw;
if (isset($this->rectype))
$this->sheets[$this->sn][''cellsInfo''][$row + $this->_rowoffset][$col + $this->_coloffset][''type''] = $this->rectype;
}
function _GetIEEE754($rknum)
{
if (($rknum & 0x02) != 0) {
$value = $rknum >> 2;
} else {
//mmp
// first comment out the previously existing 7 lines of code here
// $tmp = unpack("d",
  • 上一篇资讯: PHP学习笔记之数组篇
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号