BIFFwriter
in package
Table of Contents
Properties
- $_data : string|null
- The string containing the data of the BIFF stream.
- $_datasize : int
- The size of the data in bytes. Should be the same as strlen($this->_data).
- $byteOrder : int|null
- The byte order of this architecture. 0 => little endian, 1 => big endian.
- $limit : int
- The maximum length for a BIFF record (excluding record header and length field). See addContinue().
Methods
- __construct() : mixed
- Constructor.
- getByteOrder() : int
- Determine the byte order and store it as class data to avoid recalculating it for each call to new().
- writeData() : string
- General storage function like append, but returns string instead of modifying $this->_data.
- writeEof() : string
- Writes Excel EOF record to indicate the end of a BIFF stream.
- append() : void
- General storage function.
- storeBof() : void
- Writes Excel BOF record to indicate the beginning of a stream or sub-stream in the BIFF file.
- storeEof() : void
- Writes Excel EOF record to indicate the end of a BIFF stream.
- addContinue() : string
- Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In Excel 97 the limit is 8228 bytes. Records that are longer than these limits must be split up into CONTINUE blocks.
Properties
$_data
The string containing the data of the BIFF stream.
public
string|null
$_data
$_datasize
The size of the data in bytes. Should be the same as strlen($this->_data).
public
int
$_datasize
$byteOrder
The byte order of this architecture. 0 => little endian, 1 => big endian.
private
static int|null
$byteOrder
$limit
The maximum length for a BIFF record (excluding record header and length field). See addContinue().
private
int
$limit
= 8224
Tags
Methods
__construct()
Constructor.
public
__construct() : mixed
getByteOrder()
Determine the byte order and store it as class data to avoid recalculating it for each call to new().
public
static getByteOrder() : int
Return values
intwriteData()
General storage function like append, but returns string instead of modifying $this->_data.
public
writeData(string $data) : string
Parameters
- $data : string
-
binary data to write
Return values
stringwriteEof()
Writes Excel EOF record to indicate the end of a BIFF stream.
public
writeEof() : string
Return values
stringappend()
General storage function.
protected
append(string $data) : void
Parameters
- $data : string
-
binary data to append
storeBof()
Writes Excel BOF record to indicate the beginning of a stream or sub-stream in the BIFF file.
protected
storeBof(int $type) : void
Parameters
- $type : int
-
type of BIFF file to write: 0x0005 Workbook, 0x0010 Worksheet
storeEof()
Writes Excel EOF record to indicate the end of a BIFF stream.
protected
storeEof() : void
addContinue()
Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In Excel 97 the limit is 8228 bytes. Records that are longer than these limits must be split up into CONTINUE blocks.
private
addContinue(string $data) : string
This function takes a long BIFF record and inserts CONTINUE records as necessary.
Parameters
- $data : string
-
The original binary data to be written
Return values
string —A very convenient string of continue blocks