OLE
in package
OLE package base class.
Tags
Table of Contents
Constants
- OLE_DATA_SIZE_SMALL = 0x1000
- OLE_LONG_INT_SIZE = 4
- OLE_PPS_SIZE = 0x80
- OLE_PPS_TYPE_DIR = 1
- OLE_PPS_TYPE_FILE = 2
- OLE_PPS_TYPE_ROOT = 5
- SIGNED_4OCTET_LIMIT = 2147483648
- SIGNED_4OCTET_SUBTRACT = 2 * self::SIGNED_4OCTET_LIMIT
Properties
- $_file_handle : resource
- The file handle for reading an OLE container.
- $_list : array<string|int, mixed>
- Array of PPS's found on the OLE container.
- $bbat : array<string|int, mixed>
- Big Block Allocation Table.
- $bigBlockSize : int
- Size of big blocks. This is usually 512.
- $bigBlockThreshold : int
- Threshold for big blocks.
- $root : Root
- Root directory of OLE container.
- $sbat : array<string|int, mixed>
- Short Block Allocation Table.
- $smallBlockSize : int
- Size of small blocks. This is usually 64.
Methods
- ascToUcs() : string
- Utility function to transform ASCII text to Unicode.
- getBlockOffset() : int
- getData() : string
- Gets data from a PPS If there is no PPS for the index given, it will return an empty string.
- getDataLength() : int
- Gets the data length from a PPS If there is no PPS for the index given, it will return 0.
- getStream() : resource
- Returns a stream for use with fread() etc. External callers should use \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File::getStream().
- isFile() : bool
- Checks whether a PPS is a File PPS or not.
- isRoot() : bool
- Checks whether a PPS is a Root PPS or not.
- localDateToOLE() : string
- Utility function Returns a string for the OLE container with the date given.
- OLE2LocalDate() : float|int
- Returns a timestamp from an OLE container's date.
- ppsTotal() : int
- Gives the total number of PPS's found in the OLE container.
- read() : bool
- Reads an OLE container from the contents of the file given.
- readPpsWks() : bool
- Gets information about all PPS's on the OLE container from the PPS WK's creates an OLE_PPS object for each one.
- ppsTreeComplete() : bool
- It checks whether the PPS tree is complete (all PPS's read) starting with the given PPS (not necessarily root).
- readInt1() : int
- Reads a signed char.
- readInt2() : int
- Reads an unsigned short (2 octets).
- readInt4() : int
- Reads long (4 octets), interpreted as if signed on 32-bit system.
Constants
OLE_DATA_SIZE_SMALL
public
mixed
OLE_DATA_SIZE_SMALL
= 0x1000
OLE_LONG_INT_SIZE
public
mixed
OLE_LONG_INT_SIZE
= 4
OLE_PPS_SIZE
public
mixed
OLE_PPS_SIZE
= 0x80
OLE_PPS_TYPE_DIR
public
mixed
OLE_PPS_TYPE_DIR
= 1
OLE_PPS_TYPE_FILE
public
mixed
OLE_PPS_TYPE_FILE
= 2
OLE_PPS_TYPE_ROOT
public
mixed
OLE_PPS_TYPE_ROOT
= 5
SIGNED_4OCTET_LIMIT
private
mixed
SIGNED_4OCTET_LIMIT
= 2147483648
SIGNED_4OCTET_SUBTRACT
private
mixed
SIGNED_4OCTET_SUBTRACT
= 2 * self::SIGNED_4OCTET_LIMIT
Properties
$_file_handle
The file handle for reading an OLE container.
public
resource
$_file_handle
$_list
Array of PPS's found on the OLE container.
public
array<string|int, mixed>
$_list
= []
$bbat
Big Block Allocation Table.
public
array<string|int, mixed>
$bbat
(blockId => nextBlockId)
$bigBlockSize
Size of big blocks. This is usually 512.
public
int
$bigBlockSize
number of octets per block
$bigBlockThreshold
Threshold for big blocks.
public
int
$bigBlockThreshold
$root
Root directory of OLE container.
public
Root
$root
$sbat
Short Block Allocation Table.
public
array<string|int, mixed>
$sbat
(blockId => nextBlockId)
$smallBlockSize
Size of small blocks. This is usually 64.
public
int
$smallBlockSize
number of octets per block
Methods
ascToUcs()
Utility function to transform ASCII text to Unicode.
public
static ascToUcs(string $ascii) : string
Parameters
- $ascii : string
-
The ASCII string to transform
Return values
string —The string in Unicode
getBlockOffset()
public
getBlockOffset(int $blockId) : int
Parameters
- $blockId : int
-
byte offset from beginning of file
Return values
intgetData()
Gets data from a PPS If there is no PPS for the index given, it will return an empty string.
public
getData(int $index, int $position, int $length) : string
Parameters
- $index : int
-
The index for the PPS
- $position : int
-
The position from which to start reading (relative to the PPS)
- $length : int
-
The amount of bytes to read (at most)
Tags
Return values
string —The binary string containing the data requested
getDataLength()
Gets the data length from a PPS If there is no PPS for the index given, it will return 0.
public
getDataLength(int $index) : int
Parameters
- $index : int
-
The index for the PPS
Return values
int —The amount of bytes in data the PPS has
getStream()
Returns a stream for use with fread() etc. External callers should use \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File::getStream().
public
getStream(int|PPS $blockIdOrPps) : resource
Parameters
- $blockIdOrPps : int|PPS
-
block id or PPS
Return values
resource —read-only stream
isFile()
Checks whether a PPS is a File PPS or not.
public
isFile(int $index) : bool
If there is no PPS for the index given, it will return false.
Parameters
- $index : int
-
The index for the PPS
Return values
bool —true if it's a File PPS, false otherwise
isRoot()
Checks whether a PPS is a Root PPS or not.
public
isRoot(int $index) : bool
If there is no PPS for the index given, it will return false.
Parameters
- $index : int
-
the index for the PPS
Return values
bool —true if it's a Root PPS, false otherwise
localDateToOLE()
Utility function Returns a string for the OLE container with the date given.
public
static localDateToOLE(float|int $date) : string
Parameters
- $date : float|int
-
A timestamp
Return values
string —The string for the OLE container
OLE2LocalDate()
Returns a timestamp from an OLE container's date.
public
static OLE2LocalDate(string $oleTimestamp) : float|int
Parameters
- $oleTimestamp : string
-
A binary string with the encoded date
Return values
float|int —The Unix timestamp corresponding to the string
ppsTotal()
Gives the total number of PPS's found in the OLE container.
public
ppsTotal() : int
Return values
int —The total number of PPS's found in the OLE container
read()
Reads an OLE container from the contents of the file given.
public
read(string $filename) : bool
Parameters
- $filename : string
Tags
Return values
bool —true on success, PEAR_Error on failure
readPpsWks()
Gets information about all PPS's on the OLE container from the PPS WK's creates an OLE_PPS object for each one.
public
readPpsWks(int $blockId) : bool
Parameters
- $blockId : int
-
the block id of the first block
Return values
bool —true on success, PEAR_Error on failure
ppsTreeComplete()
It checks whether the PPS tree is complete (all PPS's read) starting with the given PPS (not necessarily root).
private
ppsTreeComplete(int $index) : bool
Parameters
- $index : int
-
The index of the PPS from which we are checking
Return values
bool —Whether the PPS tree for the given PPS is complete
readInt1()
Reads a signed char.
private
static readInt1(resource $fileHandle) : int
Parameters
- $fileHandle : resource
-
file handle
Return values
intreadInt2()
Reads an unsigned short (2 octets).
private
static readInt2(resource $fileHandle) : int
Parameters
- $fileHandle : resource
-
file handle
Return values
intreadInt4()
Reads long (4 octets), interpreted as if signed on 32-bit system.
private
static readInt4(resource $fileHandle) : int
Parameters
- $fileHandle : resource
-
file handle