PHPExcel classes » \PHPExcel_Writer_Excel5_Workbook

PHPExcel_Writer_Excel5_Workbook

category | PHPExcel
package | PHPExcel_Writer_Excel5
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

## Class constructor

    __construct(\PHPExcel $phpExcel, int $str_total, int $str_unique, array $str_table, array $colors, mixed $parser)

### Parameters

#### $phpExcel

`\PHPExcel`

The Workbook

#### $str_total

`int`

&$str_total Total number of strings

#### $str_unique

`int`

&$str_unique Total number of unique strings

#### $str_table

`array`

&$str_table String Table

#### $colors

`array`

&$colors Colour Table

#### $parser

`mixed`

The formula parser created for the Workbook

## Excel limits the size of BIFF records.

    _addContinue(string $data) : string

Inherited

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.

access | private
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_addContinue()

### Parameters

#### $data

`string`

The original binary data to be written

### Returns

`string`A very convenient string of continue blocks

## Add a font to added fonts

    _addFont(\PHPExcel_Style_Font $font) : int

### Parameters

#### $font

`\PHPExcel_Style_Font`

### Returns

`int`Index to FONT record

## General storage function

    _append(string $data)

Inherited

access | private
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_append()

### Parameters

#### $data

`string`

binary data to append

## Calculate offsets for Worksheet BOF records.

    _calcSheetOffsets()

access | private

## Sets the colour palette to the Excel 97+ default.

    _setPaletteXl97()

access | private

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

    _storeBof(integer $type)

Inherited

access | private
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_storeBof()

### Parameters

#### $type

`integer`

Type of BIFF file to write: 0x0005 Workbook, 0x0010 Worksheet.

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

    _storeEof()

Inherited

access | private
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_storeEof()

## Add a new XF writer

    addXfWriter(\PHPExcel_Style $style, boolean $isStyleXf) : int

### Parameters

#### $style

`\PHPExcel_Style`

#### $isStyleXf

`boolean`

Is it a style XF?

### Returns

`int`Index to XF record

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

    getByteOrder() : int

InheritedStatic

inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()

### Returns

`int`

## Get Escher object

    getEscher() : \PHPExcel_Shared_Escher

### Returns

`\PHPExcel_Shared_Escher`

## Set Escher object

    setEscher(\PHPExcel_Shared_Escher $pValue)

### Parameters

#### $pValue

`\PHPExcel_Shared_Escher`

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

    writeData(string $data) : string

Inherited

inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::writeData()

### Parameters

#### $data

`string`

binary data to write

### Returns

`string`

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

    writeEof()

Inherited

access | private
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::writeEof()

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

    writeWorkbook(array $pWorksheetSizes) : string

### Parameters

#### $pWorksheetSizes

`array`

The sizes in bytes of the binary worksheet streams

### Returns

`string`Binary data for workbook stream

## Alter color palette adding a custom color

    _addColor(string $rgb) : int

### Parameters

#### $rgb

`string`

E.g. 'FF00AA'

### Returns

`int`Color index

## Writes all the DEFINEDNAME records (BIFF8).

    _writeAllDefinedNamesBiff8()

So far this is only used for repeating rows/columns (print titles) and print areas

## Store the Excel FONT records.

    _writeAllFonts()

## Store user defined numerical formats i.e.

    _writeAllNumFormats()

FORMAT records

## Write all STYLE records.

    _writeAllStyles()

## Write all XF records.

    _writeAllXfs()

## Writes Excel BIFF BOUNDSHEET record.

    _writeBoundsheet(\PHPExcel_Worksheet $sheet, integer $offset)

### Parameters

#### $sheet

`\PHPExcel_Worksheet`

Worksheet name

#### $offset

`integer`

Location of worksheet BOF

## Stores the CODEPAGE biff record.

    _writeCodepage()

## Stores the COUNTRY record for localization

    _writeCountry() : string

### Returns

`string`

## Write DATEMODE record to indicate the date system in use (1904 or 1900).

    _writeDatemode()

## Write a DEFINEDNAME record for BIFF8 using explicit binary formula data

    _writeDefinedNameBiff8(string $name, string $formulaData, string $sheetIndex, boolean $isBuiltIn) : string

### Parameters

#### $name

`string`

The name in UTF-8

#### $formulaData

`string`

The binary formula data

#### $sheetIndex

`string`

1-based sheet index the defined name applies to. 0 = global

#### $isBuiltIn

`boolean`

Built-in name?

### Returns

`string`Complete binary record data

## Write BIFF record EXTERNCOUNT to indicate the number of external sheet references in the workbook.

    _writeExterncount(integer $cxals)

Excel only stores references to external sheets that are used in NAME. The workbook NAME record is required to define the print area and the repeat rows and columns.

A similar method is used in Worksheet.php for a slightly different purpose.

### Parameters

#### $cxals

`integer`

Number of external references

## Write the EXTERNCOUNT and EXTERNSHEET records.

    _writeExterns()

These are used as indexes for the NAME records.

## Writes the Excel BIFF EXTERNSHEET record.

    _writeExternsheet(string $sheetname)

These references are used by formulas. NAME record is required to define the print area and the repeat rows and columns.

A similar method is used in Worksheet.php for a slightly different purpose.

### Parameters

#### $sheetname

`string`

Worksheet name

## Writes the Excel BIFF EXTERNSHEET record.

    _writeExternsheetBiff8()

These references are used by formulas.

## Writes the MSODRAWINGGROUP record if needed.

    _writeMsoDrawingGroup()

Possibly split using CONTINUE records.

## Store the NAME record in the long format that is used for storing the repeat rows and columns when both are specified.

    _writeNameLong(integer $index, integer $type, integer $rowmin, integer $rowmax, integer $colmin, integer $colmax)

This shares a lot of code with _writeNameShort() but we use a separate method to keep the code clean. Code abstraction for reuse can be carried too far, and I should know. ;-)

### Parameters

#### $index

`integer`

Sheet index

#### $type

`integer`

Built-in name type

#### $rowmin

`integer`

Start row

#### $rowmax

`integer`

End row

#### $colmin

`integer`

Start colum

#### $colmax

`integer`

End column

## Store the NAME record in the short format that is used for storing the print area, repeat rows only and repeat columns only.

    _writeNameShort(integer $index, integer $type, integer $rowmin, integer $rowmax, integer $colmin, integer $colmax)

### Parameters

#### $index

`integer`

Sheet index

#### $type

`integer`

Built-in name type

#### $rowmin

`integer`

Start row

#### $rowmax

`integer`

End row

#### $colmin

`integer`

Start colum

#### $colmax

`integer`

End column

## Write the NAME record to define the print area and the repeat rows and cols.

    _writeNames()

## Writes Excel FORMAT record for non "built-in" numerical formats.

    _writeNumFormat(string $format, integer $ifmt)

### Parameters

#### $format

`string`

Custom format string

#### $ifmt

`integer`

Format index code

## Stores the PALETTE biff record.

    _writePalette()

## Write the RECALCID record

    _writeRecalcId() : string

### Returns

`string`

## Handling of the SST continue blocks is complicated by the need to include an additional continuation byte depending on whether the string is split between blocks or whether it starts at the beginning of the block.

    _writeSharedStringsTable() : string

(There are also additional complications that will arise later when/if Rich Strings are supported).

The Excel documentation says that the SST record should be followed by an EXTSST record. The EXTSST record is a hash table that is used to optimise access to SST. However, despite the documentation it doesn't seem to be required so we will ignore it.

### Returns

`string`Binary data

## Write a short NAME record

    _writeShortNameBiff8(string $name, string $sheetIndex, \integer[][] $rangeBounds, boolean $isHidden) : string

### Parameters

#### $name

`string`

#### $sheetIndex

`string`

1-based sheet index the defined name applies to. 0 = global

#### $rangeBounds

`\integer[][]`

range boundaries

#### $isHidden

`boolean`

### Returns

`string`Complete binary record data

## Write Excel BIFF STYLE records.

    _writeStyle()

## Write Internal SUPBOOK record

    _writeSupbookInternal()

## Write Excel BIFF WINDOW1 record.

    _writeWindow1()

### Properties

##

    $_biffsize : integer

see | \_calcSheetOffsets()

##

    $_codepage : integer

##

    $_country_code : integer

##

    $_data : string

Inherited

inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_data

##

    $_datasize : integer

Inherited

Should be the same as strlen($this->_data)

inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_datasize

##

    $_limit : integer

Inherited

See _addContinue()

see | \_addContinue()
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_limit

##

    $_palette : array

##

    $_addedFonts : array

Maps from font's hash => index in workbook

##

    $_addedNumberFormats : array

Maps from numberFormat's hash => index in workbook

##

    $_byte_order : integer

Inherited

0 => little endian, 1 => big endian

inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_byte_order

##

    $_colors

##

    $_escher : \PHPExcel_Shared_Escher

##

    $_fontWriters : \PHPExcel_Writer_Excel5_Font[]

##

    $_numberFormats : array

##

    $_parser : \PHPExcel_Writer_Excel5_Parser

##

    $_phpExcel : \PHPExcel

##

    $_str_table : array

##

    $_str_total : int

##

    $_str_unique : int

##

    $_worksheetOffsets : array

##

    $_worksheetSizes : array

##

    $_xfWriters : \PHPExcel_Writer_Excel5_Xf[]