ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 private

Definition at line 229 of file BIFFwriter.php.

References $_limit, $data, $header, and $i.

Referenced by _append(), and writeData().

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  }
$i
Definition: disco.tpl.php:19
+ Here is the caller graph for this function:

◆ _append()

PHPExcel_Writer_Excel5_BIFFwriter::_append (   $data)

General storage function.

Parameters
string$databinary data to append private

Definition at line 139 of file BIFFwriter.php.

References $data, and _addContinue().

Referenced by _storeBof(), _storeEof(), PHPExcel_Writer_Excel5_Workbook\_writeAllFonts(), PHPExcel_Writer_Excel5_Workbook\_writeAllXfs(), PHPExcel_Writer_Excel5_Worksheet\_writeAutoFilterInfo(), PHPExcel_Writer_Excel5_Worksheet\_writeBlank(), PHPExcel_Writer_Excel5_Worksheet\_writeBoolErr(), PHPExcel_Writer_Excel5_Worksheet\_writeBreaks(), PHPExcel_Writer_Excel5_Worksheet\_writeCFHeader(), PHPExcel_Writer_Excel5_Worksheet\_writeCFRule(), PHPExcel_Writer_Excel5_Worksheet\_writeColinfo(), PHPExcel_Writer_Excel5_Worksheet\_writeDataValidity(), PHPExcel_Writer_Excel5_Worksheet\_writeDefaultRowHeight(), PHPExcel_Writer_Excel5_Worksheet\_writeDefcol(), PHPExcel_Writer_Excel5_Worksheet\_writeDimensions(), PHPExcel_Writer_Excel5_Worksheet\_writeExterncount(), PHPExcel_Writer_Excel5_Worksheet\_writeExternsheet(), PHPExcel_Writer_Excel5_Worksheet\_writeFooter(), PHPExcel_Writer_Excel5_Worksheet\_writeFormula(), PHPExcel_Writer_Excel5_Worksheet\_writeGridset(), PHPExcel_Writer_Excel5_Worksheet\_writeGuts(), PHPExcel_Writer_Excel5_Worksheet\_writeHcenter(), PHPExcel_Writer_Excel5_Worksheet\_writeHeader(), PHPExcel_Writer_Excel5_Worksheet\_writeLabel(), PHPExcel_Writer_Excel5_Worksheet\_writeLabelSst(), PHPExcel_Writer_Excel5_Worksheet\_writeMarginBottom(), PHPExcel_Writer_Excel5_Worksheet\_writeMarginLeft(), PHPExcel_Writer_Excel5_Worksheet\_writeMarginRight(), PHPExcel_Writer_Excel5_Worksheet\_writeMarginTop(), PHPExcel_Writer_Excel5_Worksheet\_writeMergedCells(), PHPExcel_Writer_Excel5_Worksheet\_writeMsoDrawing(), PHPExcel_Writer_Excel5_Worksheet\_writeNote(), PHPExcel_Writer_Excel5_Worksheet\_writeNumber(), PHPExcel_Writer_Excel5_Worksheet\_writeObjectProtect(), PHPExcel_Writer_Excel5_Worksheet\_writeObjPicture(), PHPExcel_Writer_Excel5_Worksheet\_writePageLayoutView(), PHPExcel_Writer_Excel5_Worksheet\_writePanes(), PHPExcel_Writer_Excel5_Worksheet\_writePassword(), PHPExcel_Writer_Excel5_Worksheet\_writePrintGridlines(), PHPExcel_Writer_Excel5_Worksheet\_writePrintHeaders(), PHPExcel_Writer_Excel5_Worksheet\_writeProtect(), PHPExcel_Writer_Excel5_Worksheet\_writeRangeProtection(), PHPExcel_Writer_Excel5_Worksheet\_writeRichTextString(), PHPExcel_Writer_Excel5_Worksheet\_writeRow(), PHPExcel_Writer_Excel5_Worksheet\_writeScenProtect(), PHPExcel_Writer_Excel5_Worksheet\_writeSelection(), PHPExcel_Writer_Excel5_Worksheet\_writeSetup(), PHPExcel_Writer_Excel5_Worksheet\_writeSheetLayout(), PHPExcel_Writer_Excel5_Worksheet\_writeSheetProtection(), PHPExcel_Writer_Excel5_Worksheet\_writeStringRecord(), PHPExcel_Writer_Excel5_Worksheet\_writeUrlInternal(), PHPExcel_Writer_Excel5_Worksheet\_writeUrlWeb(), PHPExcel_Writer_Excel5_Worksheet\_writeVcenter(), PHPExcel_Writer_Excel5_Worksheet\_writeWindow2(), PHPExcel_Writer_Excel5_Worksheet\_writeWsbool(), PHPExcel_Writer_Excel5_Worksheet\_writeZoom(), and PHPExcel_Writer_Excel5_Worksheet\insertBitmap().

140  {
141  if (strlen($data) - 4 > $this->_limit) {
142  $data = $this->_addContinue($data);
143  }
144  $this->_data .= $data;
145  $this->_datasize += strlen($data);
146  }
_addContinue($data)
Excel limits the size of BIFF records.
Definition: BIFFwriter.php:229
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _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. private

Definition at line 172 of file BIFFwriter.php.

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

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

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
$type
+ 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.

private

Definition at line 195 of file BIFFwriter.php.

References $header, and _append().

Referenced by PHPExcel_Writer_Excel5_Worksheet\close().

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  }
_append($data)
General storage function.
Definition: BIFFwriter.php:139
+ 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.

Referenced by PHPExcel_Writer_Excel5_Parser\_convertNumber().

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  }
+ 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.

References $data, and _addContinue().

Referenced by writeEof().

155  {
156  if (strlen($data) - 4 > $this->_limit) {
157  $data = $this->_addContinue($data);
158  }
159  $this->_datasize += strlen($data);
160 
161  return $data;
162  }
_addContinue($data)
Excel limits the size of BIFF records.
Definition: BIFFwriter.php:229
+ 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.

private

Definition at line 209 of file BIFFwriter.php.

References $header, and writeData().

Referenced by PHPExcel_Writer_Excel5_Workbook\writeWorkbook().

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
+ 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.

◆ $_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: