class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter

Properties

string $_data The string containing the data of the BIFF stream from PHPExcel_Writer_Excel5_BIFFwriter
integer $_datasize The size of the data in bytes. Should be the same as strlen($this->_data) from PHPExcel_Writer_Excel5_BIFFwriter
PHPExcel_Worksheet $phpSheet Sheet object
array $fontHashIndex Array of font hashes associated to FONT records index

Methods

__construct($str_total, $str_unique, $str_table, $colors, $parser, $preCalculateFormulas, $phpSheet)

Constructor

static int
getByteOrder()

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

string
writeData(string $data)

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

writeEof()

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

close()

Add data to the beginning of the workbook (note the reverse order) and to the end of the workbook.

string
getData()

Retrieves data from memory in one chunk, or from disk in $buffer sized chunks.

printRowColHeaders(integer $print = 1)

Set the option to print the row and column headers on the printed page.

setOutline(bool $visible = true, bool $symbols_below = true, bool $symbols_right = true, bool $auto_style = false)

This method sets the properties for outlining and grouping. The defaults correspond to Excel's defaults.

writeBlank(integer $row, integer $col, mixed $xfIndex)

Write a blank cell to the specified row and column (zero indexed).

integer
writeUrlRange(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

This is the more general form of writeUrl(). It allows a hyperlink to be written to a range of cells. This function also decides the type of hyperlink to be written. These are either, Web (http, ftp, mailto), Internal (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').

integer
writeUrlWeb(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

Used to write http, ftp and mailto hyperlinks.

integer
writeUrlInternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

Used to write internal reference hyperlinks such as "Sheet1!A1".

integer
writeUrlExternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

Write links to external directory names such as 'c:\foo.xls', c:\foo.xls#Sheet1!A1', '.

insertBitmap(integer $row, integer $col, mixed $bitmap, integer $x, integer $y, float $scale_x = 1, float $scale_y = 1)

Insert a 24bit bitmap image in a worksheet.

positionImage(integer $col_start, integer $row_start, integer $x1, integer $y1, integer $width, integer $height)

Calculate the vertices that define the position of the image as required by the OBJ record.

array
processBitmapGd(resource $image)

Convert a GD-image into the internal format.

array
processBitmap(string $bitmap)

Convert a 24 bit bitmap into the modified internal format used by Windows.

getEscher()

Get Escher object

setEscher(PHPExcel_Shared_Escher $pValue = null)

Set Escher object

Details

at line 215
__construct($str_total, $str_unique, $str_table, $colors, $parser, $preCalculateFormulas, $phpSheet)

Constructor

Parameters

$str_total
$str_unique
$str_table
$colors
$parser
$preCalculateFormulas
$phpSheet

static int getByteOrder()

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

Return Value

int

string writeData(string $data)

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

Parameters

string $data binary data to write

Return Value

string

writeEof()

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

at line 278
close()

Add data to the beginning of the workbook (note the reverse order) and to the end of the workbook.

See also

PHPExcel_Writer_Excel5_Workbook::storeWorkbook()

at line 569
string getData()

Retrieves data from memory in one chunk, or from disk in $buffer sized chunks.

Return Value

string The data

at line 589
printRowColHeaders(integer $print = 1)

Set the option to print the row and column headers on the printed page.

Parameters

integer $print Whether to print the headers or not. Defaults to 1 (print).

at line 603
setOutline(bool $visible = true, bool $symbols_below = true, bool $symbols_right = true, bool $auto_style = false)

This method sets the properties for outlining and grouping. The defaults correspond to Excel's defaults.

Parameters

bool $visible
bool $symbols_below
bool $symbols_right
bool $auto_style

at line 800
writeBlank(integer $row, integer $col, mixed $xfIndex)

Write a blank cell to the specified row and column (zero indexed).

A blank cell is used to specify formatting without adding a string or a number.

A blank cell without a format serves no purpose. Therefore, we don't write a BLANK record unless a format is specified.

Returns 0 : normal termination (including no format) -1 : insufficient number of arguments -2 : row or column out of range

Parameters

integer $row Zero indexed row
integer $col Zero indexed column
mixed $xfIndex The XF format index

at line 981
integer writeUrlRange(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

This is the more general form of writeUrl(). It allows a hyperlink to be written to a range of cells. This function also decides the type of hyperlink to be written. These are either, Web (http, ftp, mailto), Internal (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').

Parameters

integer $row1 Start row
integer $col1 Start column
integer $row2 End row
integer $col2 End column
string $url URL string

Return Value

integer

See also

writeUrl()

at line 1007
integer writeUrlWeb(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

Used to write http, ftp and mailto hyperlinks.

The link type ($options) is 0x03 is the same as absolute dir ref without sheet. However it is differentiated by the $unknown2 data stream.

Parameters

integer $row1 Start row
integer $col1 Start column
integer $row2 End row
integer $col2 End column
string $url URL string

Return Value

integer

See also

writeUrl()

at line 1052
integer writeUrlInternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

Used to write internal reference hyperlinks such as "Sheet1!A1".

Parameters

integer $row1 Start row
integer $col1 Start column
integer $row2 End row
integer $col2 End column
string $url URL string

Return Value

integer

See also

writeUrl()

at line 1105
integer writeUrlExternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url)

Write links to external directory names such as 'c:\foo.xls', c:\foo.xls#Sheet1!A1', '.

./../foo.xls'. and '../../foo.xls#Sheet1!A1'.

Note: Excel writes some relative links with the $dir_long string. We ignore these cases for the sake of simpler code.

Parameters

integer $row1 Start row
integer $col1 Start column
integer $row2 End row
integer $col2 End column
string $url URL string

Return Value

integer

See also

writeUrl()

at line 2326
insertBitmap(integer $row, integer $col, mixed $bitmap, integer $x, integer $y, float $scale_x = 1, float $scale_y = 1)

Insert a 24bit bitmap image in a worksheet.

Parameters

integer $row The row we are going to insert the bitmap into
integer $col The column we are going to insert the bitmap into
mixed $bitmap The bitmap filename or GD-image resource
integer $x The horizontal position (offset) of the image inside the cell.
integer $y The vertical position (offset) of the image inside the cell.
float $scale_x The horizontal scale
float $scale_y The vertical scale

at line 2400
positionImage(integer $col_start, integer $row_start, integer $x1, integer $y1, integer $width, integer $height)

Calculate the vertices that define the position of the image as required by the OBJ record.

+------------+------------+ | A | B | +-----+------------+------------+ | |(x1,y1) | | | 1 |(A1)._______|______ | | | | | | | | | | | +-----+----| BITMAP |-----+ | | | | | | 2 | |______________. | | | | (B2)| | | | (x2,y2)| +---- +------------+------------+

Example of a bitmap that covers some of the area from cell A1 to cell B2.

Based on the width and height of the bitmap we need to calculate 8 vars: $colstart, $rowstart, $colend, $rowend, $x1, $y1, $x2, $y2. The width and height of the cells are also variable and have to be taken into account. The values of $colstart and $rowstart are passed in from the calling function. The values of $colend and $rowend are calculated by subtracting the width and height of the bitmap from the width and height of the underlying cells. The vertices are expressed as a percentage of the underlying cell width as follows (rhs values are in pixels):

  x1 = X / W *1024
  y1 = Y / H *256
  x2 = (X-1) / W *1024
  y2 = (Y-1) / H *256

  Where:  X is distance from the left side of the underlying cell
          Y is distance from the top of the underlying cell
          W is the width of the cell
          H is the height of the cell

The SDK incorrectly states that the height should be expressed as a percentage of 1024.

Parameters

integer $col_start Col containing upper left corner of object
integer $row_start Row containing top left corner of object
integer $x1 Distance to left side of object
integer $y1 Distance to top of object
integer $width Width of image frame
integer $height Height of image frame

at line 2540
array processBitmapGd(resource $image)

Convert a GD-image into the internal format.

Parameters

resource $image The image to process

Return Value

array Array with data and properties of the bitmap

at line 2571
array processBitmap(string $bitmap)

Convert a 24 bit bitmap into the modified internal format used by Windows.

This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the MSDN library.

Parameters

string $bitmap The bitmap to process

Return Value

array Array with data and properties of the bitmap

at line 2673
PHPExcel_Shared_Escher getEscher()

Get Escher object

Return Value

PHPExcel_Shared_Escher

at line 2683
setEscher(PHPExcel_Shared_Escher $pValue = null)

Set Escher object

Parameters

PHPExcel_Shared_Escher $pValue