ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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. More...
 
 _append ($data)
 General storage function. More...
 
 writeData ($data)
 General storage function like _append, but returns string instead of modifying $this->_data. More...
 
 _storeBof ($type)
 Writes Excel BOF record to indicate the beginning of a stream or sub-stream in the BIFF file. More...
 
 _storeEof ()
 Writes Excel EOF record to indicate the end of a BIFF stream. More...
 
 writeEof ()
 Writes Excel EOF record to indicate the end of a BIFF stream. More...
 
 _addContinue ($data)
 Excel limits the size of BIFF records. More...
 

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(). More...
 

Data Fields

 $_data
 
 $_datasize
 
 $_limit = 8224
 

Static Private Attributes

static $_byte_order
 

Detailed Description

Definition at line 70 of file BIFFwriter.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Writer_Excel5_BIFFwriter::__construct ( )

Constructor.

Definition at line 100 of file BIFFwriter.php.

101 {
102 $this->_data = '';
103 $this->_datasize = 0;
104// $this->_limit = 8224;
105 }

Member Function Documentation

◆ _addContinue()

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 @access private

Definition at line 229 of file BIFFwriter.php.

230 {
231 $limit = $this->_limit;
232 $record = 0x003C; // Record identifier
233
234 // The first 2080/8224 bytes remain intact. However, we have to change
235 // the length field of the record.
236 $tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit);
237
238 $header = pack("vv", $record, $limit); // Headers for continue records
239
240 // Retrieve chunks of 2080/8224 bytes +4 for the header.
241 $data_length = strlen($data);
242 for ($i = $limit + 4; $i < ($data_length - $limit); $i += $limit) {
243 $tmp .= $header;
244 $tmp .= substr($data, $i, $limit);
245 }
246
247 // Retrieve the last chunk of data
248 $header = pack("vv", $record, strlen($data) - $i);
249 $tmp .= $header;
250 $tmp .= substr($data, $i, strlen($data) - $i);
251
252 return $tmp;
253 }
$header

References $_limit, $data, and $header.

Referenced by _append(), and writeData().

+ Here is the caller graph for this function:

◆ _append()

PHPExcel_Writer_Excel5_BIFFwriter::_append (   $data)

◆ _storeBof()

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. @access private

Definition at line 172 of file BIFFwriter.php.

173 {
174 $record = 0x0809; // Record identifier (BIFF5-BIFF8)
175 $length = 0x0010;
176
177 // by inspection of real files, MS Office Excel 2007 writes the following
178 $unknown = pack("VV", 0x000100D1, 0x00000406);
179
180 $build = 0x0DBB; // Excel 97
181 $year = 0x07CC; // Excel 97
182
183 $version = 0x0600; // BIFF8
184
185 $header = pack("vv", $record, $length);
186 $data = pack("vvvv", $version, $type, $build, $year);
187 $this->_append($header . $data . $unknown);
188 }
_append($data)
General storage function.
Definition: BIFFwriter.php:139

References $data, $header, $version, and _append().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _storeEof()

PHPExcel_Writer_Excel5_BIFFwriter::_storeEof ( )

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

@access private

Definition at line 195 of file BIFFwriter.php.

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

References $header, and _append().

Referenced by PHPExcel_Writer_Excel5_Worksheet\close().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getByteOrder()

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 113 of file BIFFwriter.php.

114 {
115 if (!isset(self::$_byte_order)) {
116 // Check if "pack" gives the required IEEE 64bit float
117 $teststr = pack("d", 1.2345);
118 $number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
119 if ($number == $teststr) {
120 $byte_order = 0; // Little Endian
121 } elseif ($number == strrev($teststr)){
122 $byte_order = 1; // Big Endian
123 } else {
124 // Give up. I'll fix this in a later version.
125 throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform.");
126 }
127 self::$_byte_order = $byte_order;
128 }
129
130 return self::$_byte_order;
131 }

References $_byte_order.

Referenced by PHPExcel_Writer_Excel5_Parser\_convertNumber().

+ Here is the caller graph for this function:

◆ writeData()

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 154 of file BIFFwriter.php.

155 {
156 if (strlen($data) - 4 > $this->_limit) {
157 $data = $this->_addContinue($data);
158 }
159 $this->_datasize += strlen($data);
160
161 return $data;
162 }

References $data, and _addContinue().

Referenced by writeEof().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeEof()

PHPExcel_Writer_Excel5_BIFFwriter::writeEof ( )

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

@access private

Definition at line 209 of file BIFFwriter.php.

210 {
211 $record = 0x000A; // Record identifier
212 $length = 0x0000; // Number of bytes to follow
213 $header = pack("vv", $record, $length);
214 return $this->writeData($header);
215 }
writeData($data)
General storage function like _append, but returns string instead of modifying $this->_data.
Definition: BIFFwriter.php:154

References $header, and writeData().

Referenced by PHPExcel_Writer_Excel5_Workbook\writeWorkbook().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_byte_order

PHPExcel_Writer_Excel5_BIFFwriter::$_byte_order
staticprivate

Definition at line 76 of file BIFFwriter.php.

Referenced by getByteOrder().

◆ $_data

PHPExcel_Writer_Excel5_BIFFwriter::$_data

◆ $_datasize

PHPExcel_Writer_Excel5_BIFFwriter::$_datasize

Definition at line 88 of file BIFFwriter.php.

Referenced by PHPExcel_Writer_Excel5_Workbook\_calcSheetOffsets().

◆ $_limit

PHPExcel_Writer_Excel5_BIFFwriter::$_limit = 8224

Definition at line 95 of file BIFFwriter.php.

Referenced by _addContinue().


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