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 = 0x1000

OLE_LONG_INT_SIZE

OLE_LONG_INT_SIZE = 4

OLE_PPS_SIZE

OLE_PPS_SIZE = 0x80

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 : int

Size of big blocks. This is usually 512.

Type

int — number of octets per block.

$smallBlockSize

$smallBlockSize : int

Size of small blocks. This is usually 64.

Type

int — 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(mixed  $blockId) : mixed

Parameters

mixed $blockId

Returns

mixed —

getStream()

getStream(mixed  $blockIdOrPps) : resource

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

Parameters

mixed $blockIdOrPps

Returns

resource —

read-only stream

_readPpsWks()

_readPpsWks(mixed  $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

mixed $blockId

Returns

mixed —

true on success, PEAR_Error on failure

_ppsTreeComplete()

_ppsTreeComplete(int  $index) : bool

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

Parameters

int $index

The index of the PPS from which we are checking

Returns

bool —

Whether the PPS tree for the given PPS is complete

isFile()

isFile(int  $index) : bool

Checks whether a PPS is a File PPS or not.

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

Parameters

int $index

The index for the PPS

Returns

bool —

true if it's a File PPS, false otherwise

isRoot()

isRoot(int  $index) : bool

Checks whether a PPS is a Root PPS or not.

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

Parameters

int $index

The index for the PPS.

Returns

bool —

true if it's a Root PPS, false otherwise

ppsTotal()

ppsTotal() : int

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

Returns

int —

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

getData()

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

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

Parameters

int $index

The index for the PPS

int $position

The position from which to start reading (relative to the PPS)

int $length

The amount of bytes to read (at most)

Returns

string —

The binary string containing the data requested

getDataLength()

getDataLength(int  $index) : int

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

Parameters

int $index

The index for the PPS

Returns

int —

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(int  $date = null) : string

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

Parameters

int $date

A timestamp

Returns

string —

The string for the OLE container

OLE2LocalDate()

OLE2LocalDate(int  $string) : string

Returns a timestamp from an OLE container's date

Parameters

int $string

A binary string with the encoded date

Returns

string —

The timestamp corresponding to the string

_readInt1()

_readInt1(mixed  $fh) : int

Reads a signed char.

Parameters

mixed $fh

Returns

int —

_readInt2()

_readInt2(mixed  $fh) : int

Reads an unsigned short (2 octets).

Parameters

mixed $fh

Returns

int —

_readInt4()

_readInt4(mixed  $fh) : int

Reads an unsigned long (4 octets).

Parameters

mixed $fh

Returns

int —