$offset, PROPERTY_STORAGE_BLOCK_SIZE);
$nameSize = ord($d[SIZE_OF_NAME_POS]) | (ord($d[SIZE_OF_NAME_POS+1]) << 8);
$type = ord($d[TYPE_POS]);
//$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1;
$startBlock = GetInt4d($d, START_BLOCK_POS);
$size = GetInt4d($d, SIZE_POS);
$name = '''';
for ($i = 0; $i < $nameSize ; $i++) {
$name .= $d[$i];
}
$name = str_replace("x00", "", $name);
$this->props[] = array (
''name'' => $name,
''type'' => $type,
''startBlock'' => $startBlock,
''size'' => $size);
if (($name == "Workbook") || ($name == "Book")) {
$this->wrkbook = count($this->props) - 1;
}
if ($name == "Root Entry") {
$this->rootentry = count($this->props) - 1;
}
//echo "name ==$name=n";
$offset += PROPERTY_STORAGE_BLOCK_SIZE;
}
}
function getWorkBook(){
if ($this->props[$this->wrkbook][''size''] < SMALL_BLOCK_THRESHOLD){
// getSmallBlockStream(PropertyStorage ps)
$rootdata = $this->__readData($this->props[$this->rootentry][''startBlock'']);
$streamData = '''';
$block = $this->props[$this->wrkbook][''startBlock''];
//$count = 0;
$pos = 0;
while ($block != -2) {
$pos = $block * SMALL_BLOCK_SIZE;
$streamData .= substr($rootdata, $pos, SMALL_BLOCK_SIZE);
$block = $this->smallBlockChain[$block];
}
return $streamData;
}else{
$numBlocks = $this->props[$this->wrkbook][''size''] / BIG_BLOCK_SIZE;
if ($this->props[$this->wrkbook][''size''] % BIG_BLOCK_SIZE != 0) {
$numBlocks++;
}
if ($numBlocks == 0) return '''';
//echo "numBlocks = $numBlocksn";
//byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE];
//print_r($this->wrkbook);
$streamData = '''';
$block = $this->props[$this->wrkbook][''startBlock''];
//$count = 0;
$pos = 0;
//echo "block = $block";
while ($block != -2) {
$pos = ($block + 1) * BIG_BLOCK_SIZE;
$streamData .= substr($this->data, $pos, BIG_BLOCK_SIZE);
$block = $this->bigBlockChain[$block];
}
//echo ''stream''.$streamData;
return $streamData;
}
}
}
//oleread.php的内容end=======================================================================================================
//require_once ''OLE.php'';
define(''SPREADSHEET_EXCEL_READER_BIFF8'', 0x600);
define(''SPREADSHEET_EXCEL_READER_BIFF7'', 0x500);
define(''SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS'', 0x5);
define(''SPREADSHEET_EXCEL_READER_WORKSHEET'', 0x10);
define(''SPREADSHEET_EXCEL_READER_TYPE_BOF'', 0x809);
define(''SPREADSHEET_EXCEL_READER_TYPE_EOF'', 0x0a);
define(''SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET'', 0x85);
define(''SPREADSHEET_EXCEL_READER_TYPE_DIMENSION'', 0x200);
define(''SPREADSHEET_EXCEL_READER_TYPE_ROW'', 0x208);
define(''SPREADSHEET_EXCEL_READER_TYPE_DBCELL'', 0xd7);
define(''SPREADSHEET_EXCEL_READER_TYPE_FILEPASS'', 0x2f);
define(''SPREADSHEET_EXCEL_READER_TYPE_NOTE'', 0x1c);
define(''SPREADSHEET_EXCEL_READER_TYPE_TXO'', 0x1b6);
define(''SPREADSHEET_EXCEL_READER_TYPE_RK'', 0x7e);
define(''SPREADSHEET_EXCEL_READER_TYPE_RK2'', 0x27e);
define(''SPREADSHEET_EXCEL_READER_TYPE_MULRK'', 0xbd);