PHPExcel_Shared_OLE

# Class: PHPExcel_Shared_OLE

Source Location: /PHPExcel/Shared/OLE.php

### Class Overview

OLE package base class.

#### Author(s):

- Xavier Noguer <xnoguer@php.net>
- Christian Schmidt <schmidt@php.net>

### Variables

- $bbat
- $bigBlockSize
- $root
- $sbat
- $smallBlockSize
- $_file_handle
- $_list

### Constants

- OLE_DATA_SIZE_SMALL
- OLE_LONG_INT_SIZE
- OLE_PPS_SIZE
- OLE_PPS_TYPE_DIR
- OLE_PPS_TYPE_FILE
- OLE_PPS_TYPE_ROOT

### Methods

- Asc2Ucs
- getData
- getDataLength
- getStream
- isFile
- isRoot
- LocalDate2OLE
- OLE2LocalDate
- ppsTotal
- read
- _getBlockOffset
- _ppsTreeComplete
- _readPpsWks

### Class Details

[line 38]
OLE package base class.

#### Tags:

author: | Xavier Noguer <xnoguer@php.net>
author: | Christian Schmidt <schmidt@php.net>

[ Top ]

### Class Variables

#### $bbat =

[line 69]

Big Block Allocation Table

#### Tags:

var: | (blockId => nextBlockId)
access: | public

Type: | array

[ Top ]

#### $bigBlockSize =

[line 81]

Size of big blocks. This is usually 512.

#### Tags:

var: | number of octets per block.
access: | public

Type: | int

[ Top ]

#### $root =

[line 63]

Root directory of OLE container

#### Tags:

access: | public

Type: | OLE_PPS_Root

[ Top ]

#### $sbat =

[line 75]

Short Block Allocation Table

#### Tags:

var: | (blockId => nextBlockId)
access: | public

Type: | array

[ Top ]

#### $smallBlockSize =

[line 87]

Size of small blocks. This is usually 64.

#### Tags:

var: | number of octets per block
access: | public

Type: | int

[ Top ]

#### $_file_handle =

[line 51]

The file handle for reading an OLE container

#### Tags:

access: | public

Type: | resource

[ Top ]

#### $_list = array()

[line 57]

Array of PPS's found on the OLE container

#### Tags:

access: | public

Type: | array

[ Top ]

### Class Methods

### static method Asc2Ucs [line 446]

`static string Asc2Ucs( string $ascii)`

Utility function to transform ASCII text to Unicode

#### Tags:

return: | The string in Unicode
access: | public

#### Parameters:

string | $ascii | The ASCII string to transform

[ Top ]

### static method LocalDate2OLE [line 464]

`static string LocalDate2OLE( [integer $date = null])`

Utility function Returns a string for the OLE container with the date given

#### Tags:

return: | The string for the OLE container
access: | public

#### Parameters:

integer | $date | A timestamp

[ Top ]

### static method OLE2LocalDate [line 509]

`static string OLE2LocalDate( integer $string)`

Returns a timestamp from an OLE container's date

#### Tags:

return: | The timestamp corresponding to the string
access: | public

#### Parameters:

integer | $string | A binary string with the encoded date

[ Top ]

### method getData [line 410]

`string getData( integer $index, integer $position, integer $length)`

Gets data from a PPS If there is no PPS for the index given, it will return an empty string.

#### Tags:

return: | The binary string containing the data requested
see: | OLE_PPS_File::getStream()
access: | public

#### Parameters:

integer | $index | The index for the PPS
integer | $position | The position from which to start reading (relative to the PPS)
integer | $length | The amount of bytes to read (at most)

[ Top ]

### method getDataLength [line 430]

`integer getDataLength( integer $index)`

Gets the data length from a PPS If there is no PPS for the index given, it will return 0.

#### Tags:

return: | The amount of bytes in data the PPS has
access: | public

#### Parameters:

integer | $index | The index for the PPS

[ Top ]

### method getStream [line 197]

`resource getStream( int|PPS $blockIdOrPps)`

Returns a stream for use with fread() etc. External callers should use PHPExcel_Shared_OLE_PPS_File::getStream().

#### Tags:

return: | read-only stream
access: | public

#### Parameters:

int|PPS | $blockIdOrPps | block id or PPS

[ Top ]

### method isFile [line 363]

`bool isFile( integer $index)`

Checks whether a PPS is a File PPS or not.

If there is no PPS for the index given, it will return false.

#### Tags:

return: | true if it's a File PPS, false otherwise
access: | public

#### Parameters:

integer | $index | The index for the PPS

[ Top ]

### method isRoot [line 379]

`bool isRoot( integer $index)`

Checks whether a PPS is a Root PPS or not.

If there is no PPS for the index given, it will return false.

#### Tags:

return: | true if it's a Root PPS, false otherwise
access: | public

#### Parameters:

integer | $index | The index for the PPS.

[ Top ]

### method ppsTotal [line 393]

`integer ppsTotal( )`

Gives the total number of PPS's found in the OLE container.

#### Tags:

return: | The total number of PPS's found in the OLE container
access: | public

[ Top ]

### method read [line 96]

`mixed read( string $file)`

Reads an OLE container from the contents of the file given.

#### Tags:

return: | true on success, PEAR_Error on failure
access: | public

#### Parameters:

string | $file |

[ Top ]

### method _getBlockOffset [line 186]

`void _getBlockOffset( int $blockId, int 1)`

#### Tags:

access: | public

#### Parameters:

int | 1 | byte offset from beginning of file
int | $blockId | block id

[ Top ]

### method _ppsTreeComplete [line 343]

`boolean _ppsTreeComplete( integer $index)`

It checks whether the PPS tree is complete (all PPS's read) starting with the given PPS (not necessarily root)

#### Tags:

return: | Whether the PPS tree for the given PPS is complete
access: | public

#### Parameters:

integer | $index | The index of the PPS from which we are checking

[ Top ]

### method _readPpsWks [line 266]

`mixed _readPpsWks( integer $blockId)`

Gets information about all PPS's on the OLE container from the PPS WK's creates an OLE_PPS object for each one.

#### Tags:

return: | true on success, PEAR_Error on failure
access: | public

#### Parameters:

integer | $blockId | the block id of the first block

[ Top ]

### Class Constants

#### OLE_DATA_SIZE_SMALL = 0x1000

[line 43]

[ Top ]

#### OLE_LONG_INT_SIZE = 4

[line 44]

[ Top ]

#### OLE_PPS_SIZE = 0x80

[line 45]

[ Top ]

#### OLE_PPS_TYPE_DIR = 1

[line 41]

[ Top ]

#### OLE_PPS_TYPE_FILE = 2

[line 42]

[ Top ]

#### OLE_PPS_TYPE_ROOT = 5

[line 40]

[ Top ]

Documentation generated on Fri, 12 Oct 2012 00:16:44 +0200 by phpDocumentor 1.4.4