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

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

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/22
r code is in +2;
} elseif ((ord($this->data[$spos+6])==3) && (ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) {
//Formula result is a null string.
} else {
// result is a number, so first 14 bytes are just like a _NUMBER record
$tmp = unpack("ddouble", substr($this->data, $spos + 6, 8)); // It machine machine dependent
if ($this->isDate($spos)) {
list($string, $raw) = $this->createDate($tmp[''double'']);
// $this->addcell(DateRecord($r, 1));
}else{
//$raw = $tmp[''''];
if (isset($this->_columnsFormat[$column + 1])){
$this->curformat = $this->_columnsFormat[$column + 1];
}
$raw = $this->createNumber($spos);
$string = sprintf($this->curformat, $raw * $this->multiplier);
// $this->addcell(NumberRecord($r));
}
$this->addcell($row, $column, $string, $raw);
//echo "Number $row $column $stringn";
}
break;
case SPREADSHEET_EXCEL_READER_TYPE_BOOLERR:
$row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8;
$column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8;
$string = ord($this->data[$spos+6]);
$this->addcell($row, $column, $string);
//echo ''Type_BOOLERR ''."n";
break;
case SPREADSHEET_EXCEL_READER_TYPE_ROW:
case SPREADSHEET_EXCEL_READER_TYPE_DBCELL:
case SPREADSHEET_EXCEL_READER_TYPE_MULBLANK:
break;
case SPREADSHEET_EXCEL_READER_TYPE_LABEL:
$row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8;
$column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8;
$this->addcell($row, $column, substr($this->data, $spos + 8, ord($this->data[$spos + 6]) | ord($this->data[$spos + 7])<<8));
// $this->addcell(LabelRecord($r));
break;
case SPREADSHEET_EXCEL_READER_TYPE_EOF:
$cont = false;
break;
default:
//echo '' unknown :''.base_convert($r[''code''],10,16)."n";
break;
}
$spos += $length;
}
if (!isset($this->sheets[$this->sn][''numRows'']))
$this->sheets[$this->sn][''numRows''] = $this->sheets[$this->sn][''maxrow''];
if (!isset($this->sheets[$this->sn][''numCols'']))
$this->sheets[$this->sn][''numCols''] = $this->sheets[$this->sn][''maxcol''];
}
/**
* Check whether the current record read is a date
*
* @param todo
* @return boolean True if date, false otherwise
*/
function isDate($spos)
{
//$xfindex = GetInt2d(, 4);
$xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5]) << 8;
//echo ''check is date ''.$xfindex.'' ''.$this->formatRecords[''xfrecords''][$xfindex][''type'']."n";
//var_dump($this->formatRecords[''xfrecords''][$xfindex]);
if ($this->formatRecords[''xfrecords''][$xfindex][''type''] == ''date'') {
$this->curformat = $this->formatRecords[''xfrecords''][$xfindex][''format''];
$this->rectype = ''date'';
return true;
} else {
if ($this->formatRecords[''xfrecords''][$xfindex][''type''] == ''number'') {
$this->curformat = $this->formatRecords[''xfrecords''][$xfindex][''format''];
$this->rectype = ''nu
  • 上一篇资讯: PHP学习笔记之数组篇
  • 网学推荐

    免费论文

    原创论文

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