ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Writer_Excel5_BIFFwriter Class Reference
+ Inheritance diagram for PHPExcel_Writer_Excel5_BIFFwriter:
+ Collaboration diagram for PHPExcel_Writer_Excel5_BIFFwriter:

Public Member Functions

 __construct ()
 Constructor.
 _append ($data)
 General storage function.
 writeData ($data)
 General storage function like _append, but returns string instead of modifying $this->_data.
 _storeBof ($type)
 Writes Excel BOF record to indicate the beginning of a stream or sub-stream in the BIFF file.
 _storeEof ()
 Writes Excel EOF record to indicate the end of a BIFF stream.
 writeEof ()
 Writes Excel EOF record to indicate the end of a BIFF stream.
 _addContinue ($data)
 Excel limits the size of BIFF records.

Static Public Member Functions

static getByteOrder ()
 Determine the byte order and store it as class data to avoid recalculating it for each call to new().

Data Fields

 $_BIFF_version = 0x0500
 $_data
 $_datasize
 $_limit

Static Private Attributes

static $_byte_order

Detailed Description

Definition at line 70 of file BIFFwriter.php.

Constructor & Destructor Documentation

PHPExcel_Writer_Excel5_BIFFwriter::__construct ( )

Constructor.

Definition at line 106 of file BIFFwriter.php.

Referenced by PHPExcel_Writer_Excel5_Workbook\__construct(), and PHPExcel_Writer_Excel5_Worksheet\__construct().

{
$this->_data = '';
$this->_datasize = 0;
$this->_limit = 2080;
}

+ Here is the caller graph for this function:

Member Function Documentation

PHPExcel_Writer_Excel5_BIFFwriter::_addContinue (   $data)

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.

This function takes a long BIFF record and inserts CONTINUE records as necessary.

Parameters
string$dataThe original binary data to be written
Returns
string A very convenient string of continue blocks private

Definition at line 244 of file BIFFwriter.php.

References $_limit, and $data.

Referenced by _append(), PHPExcel_Writer_Excel5_Worksheet\_append(), and writeData().

{
$limit = $this->_limit;
$record = 0x003C; // Record identifier
// The first 2080/8224 bytes remain intact. However, we have to change
// the length field of the record.
$tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit);
$header = pack("vv", $record, $limit); // Headers for continue records
// Retrieve chunks of 2080/8224 bytes +4 for the header.
$data_length = strlen($data);
for ($i = $limit + 4; $i < ($data_length - $limit); $i += $limit) {
$tmp .= $header;
$tmp .= substr($data, $i, $limit);
}
// Retrieve the last chunk of data
$header = pack("vv", $record, strlen($data) - $i);
$tmp .= $header;
$tmp .= substr($data, $i, strlen($data) - $i);
return $tmp;
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_BIFFwriter::_storeBof (   $type)

Writes Excel BOF record to indicate the beginning of a stream or sub-stream in the BIFF file.

Parameters
integer$typeType of BIFF file to write: 0x0005 Workbook, 0x0010 Worksheet. private

Definition at line 179 of file BIFFwriter.php.

References $_BIFF_version, $data, $type, _append(), and elseif().

Referenced by PHPExcel_Writer_Excel5_Worksheet\close(), and PHPExcel_Writer_Excel5_Workbook\writeWorkbook().

{
$record = 0x0809; // Record identifier
// According to the SDK $build and $year should be set to zero.
// However, this throws a warning in Excel 5. So, use magic numbers.
if ($this->_BIFF_version == 0x0500) {
$length = 0x0008;
$unknown = '';
$build = 0x096C;
$year = 0x07C9;
} elseif ($this->_BIFF_version == 0x0600) {
$length = 0x0010;
// by inspection of real files, MS Office Excel 2007 writes the following
$unknown = pack("VV", 0x000100D1, 0x00000406);
$build = 0x0DBB;
$year = 0x07CC;
}
$header = pack("vv", $record, $length);
$data = pack("vvvv", $version, $type, $build, $year);
$this->_append($header . $data . $unknown);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_BIFFwriter::_storeEof ( )

Writes Excel EOF record to indicate the end of a BIFF stream.

private

Definition at line 211 of file BIFFwriter.php.

References _append().

Referenced by PHPExcel_Writer_Excel5_Worksheet\close().

{
$record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow
$header = pack("vv", $record, $length);
$this->_append($header);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder ( )
static

Determine the byte order and store it as class data to avoid recalculating it for each call to new().

Returns
int

Definition at line 119 of file BIFFwriter.php.

References $_byte_order, and elseif().

Referenced by PHPExcel_Writer_Excel5_Parser\_convertNumber(), PHPExcel_Writer_Excel5_Worksheet\_storeMarginBottom(), PHPExcel_Writer_Excel5_Worksheet\_storeMarginLeft(), PHPExcel_Writer_Excel5_Worksheet\_storeMarginRight(), PHPExcel_Writer_Excel5_Worksheet\_storeMarginTop(), PHPExcel_Writer_Excel5_Worksheet\_storeSetup(), and PHPExcel_Writer_Excel5_Worksheet\_writeNumber().

{
if (!isset(self::$_byte_order)) {
// Check if "pack" gives the required IEEE 64bit float
$teststr = pack("d", 1.2345);
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
if ($number == $teststr) {
$byte_order = 0; // Little Endian
} elseif ($number == strrev($teststr)){
$byte_order = 1; // Big Endian
} else {
// Give up. I'll fix this in a later version.
throw new Exception("Required floating point format ".
"not supported on this platform.");
}
self::$_byte_order = $byte_order;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_BIFFwriter::writeData (   $data)

General storage function like _append, but returns string instead of modifying $this->_data.

Parameters
string$databinary data to write
Returns
string

Definition at line 161 of file BIFFwriter.php.

References $data, and _addContinue().

Referenced by PHPExcel_Writer_Excel5_Workbook\_writeAllDefinedNamesBiff8(), PHPExcel_Writer_Excel5_Workbook\_writeCountry(), PHPExcel_Writer_Excel5_Workbook\_writeExternsheetBiff8(), PHPExcel_Writer_Excel5_Workbook\_writeMsoDrawingGroup(), PHPExcel_Writer_Excel5_Workbook\_writeRecalcId(), PHPExcel_Writer_Excel5_Workbook\_writeSharedStringsTable(), PHPExcel_Writer_Excel5_Workbook\_writeSupbookInternal(), and writeEof().

{
if (strlen($data) - 4 > $this->_limit) {
}
$this->_datasize += strlen($data);
return $data;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_BIFFwriter::writeEof ( )

Writes Excel EOF record to indicate the end of a BIFF stream.

private

Definition at line 224 of file BIFFwriter.php.

References writeData().

Referenced by PHPExcel_Writer_Excel5_Workbook\writeWorkbook().

{
$record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow
$header = pack("vv", $record, $length);
return $this->writeData($header);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Writer_Excel5_BIFFwriter::$_BIFF_version = 0x0500

Definition at line 76 of file BIFFwriter.php.

Referenced by _storeBof().

PHPExcel_Writer_Excel5_BIFFwriter::$_byte_order
staticprivate

Definition at line 82 of file BIFFwriter.php.

Referenced by getByteOrder().

PHPExcel_Writer_Excel5_BIFFwriter::$_data
PHPExcel_Writer_Excel5_BIFFwriter::$_datasize

Definition at line 94 of file BIFFwriter.php.

Referenced by PHPExcel_Writer_Excel5_Workbook\_calcSheetOffsets().

PHPExcel_Writer_Excel5_BIFFwriter::$_limit

Definition at line 101 of file BIFFwriter.php.

Referenced by _addContinue().


The documentation for this class was generated from the following file: