Documentation

Workbook extends BIFFwriter
in package

Based on PERL Spreadsheet::WriteExcel module (by John McNamara) Ported to PHP for PEAR::Spreadsheet_Excel_Writer_Workbook (by Xavier Noguer) Relicensed under the MIT License by both authors.

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

Methods

__construct()  : mixed
Class constructor.
addColor()  : int
Alter color palette adding a custom color.
addFont()  : int
Add a font to added fonts.
addXfWriter()  : int
Add a new XF writer.
getByteOrder()  : int
Determine the byte order and store it as class data to avoid recalculating it for each call to new().
getEscher()  : Escher|null
Get Escher object.
setEscher()  : void
Set Escher object.
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.
writeWorkbook()  : string
Assemble worksheets into a workbook and send the BIFF data to an OLE storage.
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.

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

Methods

__construct()

Class constructor.

public __construct(Spreadsheet $spreadsheet, int &$str_total, int &$str_unique, array<string, int> &$str_table, array<string|int, int> &$colors, Parser $parser) : mixed
Parameters
$spreadsheet : Spreadsheet

The Workbook

$str_total : int

Total number of strings

$str_unique : int

Total number of unique strings

$str_table : array<string, int>

String Table

$colors : array<string|int, int>

Colour Table

$parser : Parser

The formula parser created for the Workbook

addColor()

Alter color palette adding a custom color.

public addColor(string $rgb[, int $default = 0 ]) : int
Parameters
$rgb : string

E.g. 'FF00AA'

$default : int = 0
Return values
int —

Color index

addFont()

Add a font to added fonts.

public addFont(Font $font) : int
Parameters
$font : Font
Return values
int —

Index to FONT record

addXfWriter()

Add a new XF writer.

public addXfWriter(Style $style[, bool $isStyleXf = false ]) : int
Parameters
$style : Style
$isStyleXf : bool = false

Is it a style XF?

Return values
int —

Index to XF record

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
int

setEscher()

Set Escher object.

public setEscher(Escher|null $escher) : void
Parameters
$escher : Escher|null

writeData()

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
string

writeEof()

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

public writeEof() : string
Return values
string

writeWorkbook()

Assemble worksheets into a workbook and send the BIFF data to an OLE storage.

public writeWorkbook(array<string|int, int> $worksheetSizes) : string
Parameters
$worksheetSizes : array<string|int, int>

The sizes in bytes of the binary worksheet streams

Return values
string —

Binary data for workbook stream

append()

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

        
On this page

Search results