Constants

OLE_PPS_TYPE_ROOT

OLE_PPS_TYPE_ROOT = 5

OLE_PPS_TYPE_DIR

OLE_PPS_TYPE_DIR = 1

OLE_PPS_TYPE_FILE

OLE_PPS_TYPE_FILE = 2

OLE_DATA_SIZE_SMALL

OLE_DATA_SIZE_SMALL = 4096

OLE_LONG_INT_SIZE

OLE_LONG_INT_SIZE = 4

OLE_PPS_SIZE

OLE_PPS_SIZE = 128

Properties

$_file_handle

$_file_handle : resource

The file handle for reading an OLE container

Type

resource

$_list

$_list : array

Array of PPS's found on the OLE container

Type

array

$root

$root : \OLE_PPS_Root

Root directory of OLE container

Type

\OLE_PPS_Root

$bbat

$bbat : array

Big Block Allocation Table

Type

array — (blockId => nextBlockId)

$sbat

$sbat : array

Short Block Allocation Table

Type

array — (blockId => nextBlockId)

$bigBlockSize

$bigBlockSize : integer

Size of big blocks. This is usually 512.

Type

integer — number of octets per block.

$smallBlockSize

$smallBlockSize : integer

Size of small blocks. This is usually 64.

Type

integer — number of octets per block

Methods

read()

read(string  $file) : mixed

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

Parameters

string $file

Returns

mixed —

true on success, PEAR_Error on failure

_getBlockOffset()

_getBlockOffset(  $blockId) 

Parameters

$blockId

getStream()

getStream(  $blockIdOrPps) : resource

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

Parameters

$blockIdOrPps

Returns

resource —

read-only stream

_readPpsWks()

_readPpsWks(  $blockId) : mixed

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

Parameters

$blockId

Returns

mixed —

true on success, PEAR_Error on failure

_ppsTreeComplete()

_ppsTreeComplete(integer  $index) : boolean

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

Parameters

integer $index

The index of the PPS from which we are checking

Returns

boolean —

Whether the PPS tree for the given PPS is complete

isFile()

isFile(integer  $index) : boolean

Checks whether a PPS is a File PPS or not.

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

Parameters

integer $index

The index for the PPS

Returns

boolean —

true if it's a File PPS, false otherwise

isRoot()

isRoot(integer  $index) : boolean

Checks whether a PPS is a Root PPS or not.

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

Parameters

integer $index

The index for the PPS.

Returns

boolean —

true if it's a Root PPS, false otherwise

ppsTotal()

ppsTotal() : integer

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

Returns

integer —

The total number of PPS's found in the OLE container

getData()

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

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

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)

Returns

string —

The binary string containing the data requested

getDataLength()

getDataLength(integer  $index) : integer

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

Parameters

integer $index

The index for the PPS

Returns

integer —

The amount of bytes in data the PPS has

Asc2Ucs()

Asc2Ucs(string  $ascii) : string

Utility function to transform ASCII text to Unicode

Parameters

string $ascii

The ASCII string to transform

Returns

string —

The string in Unicode

LocalDate2OLE()

LocalDate2OLE(integer  $date = null) : string

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

Parameters

integer $date

A timestamp

Returns

string —

The string for the OLE container

OLE2LocalDate()

OLE2LocalDate(integer  $string) : string

Returns a timestamp from an OLE container's date

Parameters

integer $string

A binary string with the encoded date

Returns

string —

The timestamp corresponding to the string

_readInt1()

_readInt1(  $fh) : integer

Reads a signed char.

Parameters

$fh

Returns

integer

_readInt2()

_readInt2(  $fh) : integer

Reads an unsigned short (2 octets).

Parameters

$fh

Returns

integer

_readInt4()

_readInt4(  $fh) : integer

Reads an unsigned long (4 octets).

Parameters

$fh

Returns

integer