Class Spreadsheet_Excel_Writer_Worksheet

Description

Class for generating Excel Spreadsheets

Located in /libraries/pear/Spreadsheet/Excel/Writer/Worksheet.php (line 46)

PEAR
   |
   --Spreadsheet_Excel_Writer_BIFFwriter
      |
      --Spreadsheet_Excel_Writer_Worksheet
Variable Summary
 integer $index
 string $name
 integer $print_colmax
 integer $print_colmin
 integer $print_rowmax
 integer $print_rowmin
 integer $selected
 integer $title_colmin
 integer $title_rowmax
 integer $title_rowmin
 integer $_active_pane
 array $_colinfo
 integer $_dim_colmax
 integer $_dim_colmin
 integer $_dim_rowmax
 integer $_dim_rowmin
 resource $_filehandle
 integer $_fit_height
 bool $_fit_page
 integer $_fit_width
 string $_footer
 integer $_frozen
 integer $_hcenter
 string $_header
 float $_margin_top
 integer $_orientation
 integer $_outline_on
 array $_panes
 integer $_paper_size
 object Format $_parser
 array $_selection
 array $_str_table
 integer $_str_total
 integer $_str_unique
 object Format $_url_format
 integer $_vcenter
 integer $_xls_colmax
 integer $_xls_rowmax
 integer $_xls_strmax
Method Summary
 Spreadsheet_Excel_Writer_Worksheet Spreadsheet_Excel_Writer_Worksheet (mixed $BIFF_version, string $name, integer $index, mixed &$activesheet, mixed &$firstsheet, mixed &$str_total, mixed &$str_unique, mixed &$str_table, mixed &$url_format, mixed &$parser)
 void activate ()
 void centerHorizontally ([integer $center = 1])
 void centerVertically ([integer $center = 1])
 void close (array $sheetnames)
 void fitToPages (integer $width, integer $height)
 void freezePanes (array $panes)
 string getData ()
 string getName ()
 void hideGridlines ()
 void insertBitmap (integer $row, integer $col, string $bitmap, integer $x, integer $y, [integer $scale_x = 1], [integer $scale_y = 1])
 void mergeCells (integer $first_row, integer $first_col, integer $last_row, integer $last_col)
 void printArea (integer $first_row, integer $first_col, integer $last_row, integer $last_col)
 void printRowColHeaders ([integer $print = 1])
 void protect (string $password)
 void repeatColumns (integer $first_col, [integer $last_col = NULL])
 void repeatRows (integer $first_row, [integer $last_row = NULL])
 void select ()
 void setColumn (integer $firstcol, integer $lastcol, integer $width, mixed $format, integer $hidden, integer $level)
 void setFirstSheet ()
 void setFooter (string $string, [float $margin = 0.50])
 void setHeader (string $string, [float $margin = 0.50])
 void setHPagebreaks (array $breaks)
 void setLandscape ()
 void setMarginBottom ([float $margin = 1.00])
 void setMarginLeft ([float $margin = 0.75])
 void setMarginRight ([float $margin = 0.75])
 void setMargins (float $margin)
 void setMargins_LR (float $margin)
 void setMargins_TB (float $margin)
 void setMarginTop ([float $margin = 1.00])
 void setMerge (integer $first_row, integer $first_col, integer $last_row, integer $last_col)
 void setOutline ([bool $visible = true], [bool $symbols_below = true], [bool $symbols_right = true], [bool $auto_style = false])
 void setPaper (integer $size)
 void setPortrait ()
 void setPrintScale ([integer $scale = 100])
 void setRow (integer $row, integer $height, mixed $format, [bool $hidden = false], integer $level)
 void setSelection (integer $first_row, integer $first_column, integer $last_row, integer $last_column)
 void setValidation (mixed $row1, mixed $col1, mixed $row2, mixed $col2, mixed &$validator)
 void setVPagebreaks (array $breaks)
 void setZoom ([integer $scale = 100])
 void thawPanes (array $panes)
 void write (integer $row, integer $col, mixed $token, mixed $format)
 void writeBlank (integer $row, integer $col, mixed $format)
 mixed writeCol (integer $row, integer $col, array $val, mixed $format)
 integer writeFormula (integer $row, integer $col, string $formula, mixed $format)
 void writeNote (integer $row, integer $col, string $note)
 integer writeNumber (integer $row, integer $col, float $num, mixed $format)
 mixed writeRow (integer $row, integer $col, array $val, mixed $format)
 integer writeString (integer $row, integer $col, string $str, mixed $format)
 void writeStringBIFF8 (mixed $row, mixed $col, mixed $str, mixed $format)
 integer writeUrl (integer $row, integer $col, string $url, [string $string = ''], mixed $format)
 void _append (string $data)
 array _cellToRowcol (string $cell)
 boolean _checkRowCol (integer $row, integer $col)
 string _encodePassword (string $plaintext)
 void _initialize ()
 void _positionImage (integer $col_start, integer $row_start, integer $x1, integer $y1, integer $width, integer $height)
 array _processBitmap (string $bitmap)
 integer _sizeCol (integer $col)
 integer _sizeRow (integer $row)
 void _storeColinfo (array $col_array)
 void _storeDefcol ()
 void _storeExterncount (integer $count)
 void _storeExternsheet (string $sheetname)
 void _storeFooter ()
 void _storeGridset ()
 void _storeGuts ()
 void _storeHbreak ()
 void _storeHcenter ()
 void _storeHeader ()
 void _storeMarginTop ()
 void _storeObjPicture (integer $colL, integer $dxL, integer $rwT, integer $dyT, integer $colR, integer $dxR, integer $rwB, integer $dyB)
 void _storePanes (array $panes)
 void _storePassword ()
 void _storeProtect ()
 void _storeSelection (array $array)
 void _storeSetup ()
 void _storeVbreak ()
 void _storeVcenter ()
 void _storeWindow2 ()
 void _storeWsbool ()
 void _storeZoom ()
 array _substituteCellref (string $cell)
 integer _writeUrlExternal (integer $row1, integer $col1, integer $row2, integer $col2, string $url, string $str, mixed $format)
 integer _writeUrlInternal (integer $row1, integer $col1, integer $row2, integer $col2, string $url, string $str, mixed $format)
 integer _writeUrlRange (integer $row1, integer $col1, integer $row2, integer $col2, string $url, [string $string = ''], mixed $format)
 integer _writeUrlWeb (integer $row1, integer $col1, integer $row2, integer $col2, string $url, string $str, mixed $format)
 integer _XF (mixed &$format)
Variables
integer $index (line 58)

Index for the Worksheet

string $name (line 52)

Name of the Worksheet

integer $print_colmax (line 278)

Last column of the area to print

integer $print_colmin (line 272)

First column of the area to print

integer $print_rowmax (line 266)

Last row to of the area to print

integer $print_rowmin (line 260)

First row of the area to print

integer $selected (line 164)

Bit specifying if the worksheet is selected

integer $title_colmin (line 254)

First column to reapeat on each printed page

integer $title_rowmax (line 248)

Last row to reapeat on each printed page

integer $title_rowmin (line 242)

First row to reapeat on each printed page

integer $_active_pane (line 152)

The active pane for the worksheet

array $_colinfo (line 134)

Array containing format information for columns

integer $_dim_colmax (line 128)

Last column for the DIMENSIONS record

integer $_dim_colmin (line 121)

First column for the DIMENSIONS record

integer $_dim_rowmax (line 114)

Last row for the DIMENSIONS record

integer $_dim_rowmin (line 107)

First row for the DIMENSIONS record

resource $_filehandle (line 76)

Filehandle to the temporary file for storing data

integer $_fit_height (line 326)

Number of pages to fit high

bool $_fit_page (line 314)

Whether to fit to page when printing or not.

integer $_fit_width (line 320)

Number of pages to fit wide

string $_footer (line 188)

The page footer caption

integer $_frozen (line 158)

Bit specifying if panes are frozen

integer $_hcenter (line 194)

The horizontal centering value for the page

string $_header (line 182)

The page header caption

float $_margin_bottom (line 236)

The bottom margin for the worksheet in inches

float $_margin_foot (line 212)

The margin for the footer

float $_margin_head (line 206)

The margin for the header

float $_margin_left (line 218)

The left margin for the worksheet in inches

float $_margin_right (line 224)

The right margin for the worksheet in inches

float $_margin_top (line 230)

The top margin for the worksheet in inches

array $_merged_ranges (line 350)

Merged cell ranges

integer $_orientation (line 176)

Bit specifying paper orientation (for printing). 0 => landscape, 1 => portrait

bool $_outline_below (line 296)

Whether to have outline summary below.

integer $_outline_on (line 284)

Whether to use outline.

bool $_outline_right (line 302)

Whether to have outline summary at the right.

integer $_outline_row_level (line 308)

Outline row level.

bool $_outline_style (line 290)

Auto outline styles.

array $_panes (line 146)

Array containing the panes for the worksheet

integer $_paper_size (line 170)

The paper size (for printing) (DOCUMENT!!!)

object Format $_parser (line 70)

Reference to the parser used for parsing formulas

array $_selection (line 140)

Array containing the selected area for the worksheet

array $_str_table (line 344)

Reference to the array containing all the unique strings in the workbook

integer $_str_total (line 332)

Reference to the total number of strings in the workbook

integer $_str_unique (line 338)

Reference to the number of unique strings in the workbook

object Format $_url_format (line 64)

Reference to the (default) Format object for URLs

bool $_using_tmpfile (line 82)

Boolean indicating if we are using a temporary file for storing data

integer $_vcenter (line 200)

The vertical centering value for the page

integer $_xls_colmax (line 94)

Maximum number of columns for an Excel spreadsheet (BIFF5)

integer $_xls_rowmax (line 88)

Maximum number of rows for an Excel spreadsheet (BIFF5)

integer $_xls_strmax (line 100)

Maximum number of characters for a string (LABEL record in BIFF5)

Inherited Variables

Inherited from Spreadsheet_Excel_Writer_BIFFwriter

Spreadsheet_Excel_Writer_BIFFwriter::$_BIFF_version
Spreadsheet_Excel_Writer_BIFFwriter::$_byte_order
Spreadsheet_Excel_Writer_BIFFwriter::$_data
Spreadsheet_Excel_Writer_BIFFwriter::$_datasize
Spreadsheet_Excel_Writer_BIFFwriter::$_limit
Methods
Constructor Spreadsheet_Excel_Writer_Worksheet (line 363)

Constructor

  • access: private
Spreadsheet_Excel_Writer_Worksheet Spreadsheet_Excel_Writer_Worksheet (mixed $BIFF_version, string $name, integer $index, mixed &$activesheet, mixed &$firstsheet, mixed &$str_total, mixed &$str_unique, mixed &$str_table, mixed &$url_format, mixed &$parser)
  • string $name: The name of the new worksheet
  • integer $index: The index of the new worksheet
  • mixed &$activesheet: The current activesheet of the workbook we belong to
  • mixed &$firstsheet: The first worksheet in the workbook we belong to
  • mixed &$url_format: The default format for hyperlinks
  • mixed &$parser: The formula parser created for the Workbook
activate (line 683)

Set this worksheet as the active worksheet, i.e. the worksheet that is displayed when the workbook is opened.

Also set it as selected.

  • access: public
void activate ()
centerHorizontally (line 858)

Center the page horinzontally.

  • access: public
void centerHorizontally ([integer $center = 1])
  • integer $center: the optional value for centering. Defaults to 1 (center).
centerVertically (line 869)

Center the page vertically.

  • access: public
void centerVertically ([integer $center = 1])
  • integer $center: the optional value for centering. Defaults to 1 (center).
close (line 489)

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

  • see: Spreadsheet_Excel_Writer_Workbook::storeWorkbook()
  • access: public
void close (array $sheetnames)
  • array $sheetnames: The array of sheetnames from the Workbook this worksheet belongs to
fitToPages (line 1050)

Set the vertical and horizontal number of pages that will define the maximum area printed.

It doesn't seem to work with OpenOffice.

void fitToPages (integer $width, integer $height)
  • integer $width: Maximun width of printed area in pages
  • integer $height: Maximun heigth of printed area in pages
freezePanes (line 763)

Set panes and mark them as frozen.

  • access: public
void freezePanes (array $panes)
  • array $panes: This is the only parameter received and is composed of the following:
    1. => Vertical split position,
    2. => Horizontal split position
    3. => Top row visible
    4. => Leftmost column visible
    5. => Active pane
getData (line 619)

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

  • return: The data
string getData ()
getName (line 608)

Retrieve the worksheet name.

This is usefull when creating worksheets without a name.

  • return: The worksheet's name
  • access: public
string getName ()
hideGridlines (line 1015)

Set the option to hide gridlines on the printed page.

  • access: public
void hideGridlines ()
hideScreenGridlines (line 1025)

Set the option to hide gridlines on the worksheet (as seen on the screen).

  • access: public
void hideScreenGridlines ()
insertBitmap (line 3110)

Insert a 24bit bitmap image in a worksheet.

  • access: public
void insertBitmap (integer $row, integer $col, string $bitmap, integer $x, integer $y, [integer $scale_x = 1], [integer $scale_y = 1])
  • integer $row: The row we are going to insert the bitmap into
  • integer $col: The column we are going to insert the bitmap into
  • string $bitmap: The bitmap filename
  • integer $x: The horizontal position (offset) of the image inside the cell.
  • integer $y: The vertical position (offset) of the image inside the cell.
  • integer $scale_x: The horizontal scale
  • integer $scale_y: The vertical scale
mergeCells (line 2794)

Merges the area given by its arguments.

This is an Excel97/2000 method. It is required to perform more complicated merging than the normal setAlign('merge').

  • access: public
void mergeCells (integer $first_row, integer $first_col, integer $last_row, integer $last_col)
  • integer $first_row: First row of the area to merge
  • integer $first_col: First column of the area to merge
  • integer $last_row: Last row of the area to merge
  • integer $last_col: Last column of the area to merge
printArea (line 1001)

Set the area of each worksheet that will be printed.

  • access: public
void printArea (integer $first_row, integer $first_col, integer $last_row, integer $last_col)
  • integer $first_row: First row of the area to print
  • integer $first_col: First column of the area to print
  • integer $last_row: Last row of the area to print
  • integer $last_col: Last column of the area to print
printRowColHeaders (line 1036)

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

  • access: public
void printRowColHeaders ([integer $print = 1])
  • integer $print: Whether to print the headers or not. Defaults to 1 (print).
protect (line 709)

Set the worksheet protection flag to prevent accidental modification and to hide formulas if the locked and hidden format properties have been set.

  • access: public
void protect (string $password)
  • string $password: The password to use for protecting the sheet.
repeatColumns (line 981)

Set the columns to repeat at the left hand side of each printed page.

  • access: public
void repeatColumns (integer $first_col, [integer $last_col = NULL])
  • integer $first_col: First column to repeat
  • integer $last_col: Last column to repeat. Optional.
repeatRows (line 963)

Set the rows to repeat at the top of each printed page.

  • access: public
void repeatRows (integer $first_row, [integer $last_row = NULL])
  • integer $first_row: First row to repeat
  • integer $last_row: Last row to repeat. Optional.
select (line 671)

Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.

  • access: public
void select ()
setColumn (line 726)

Set the width of a single column or a range of columns.

  • access: public
void setColumn (integer $firstcol, integer $lastcol, integer $width, mixed $format, integer $hidden, integer $level)
  • integer $firstcol: first column on the range
  • integer $lastcol: last column on the range
  • integer $width: width to set
  • mixed $format: The optional XF format to apply to the columns
  • integer $hidden: The optional hidden atribute
  • integer $level: The optional outline level
setFirstSheet (line 696)

Set this worksheet as the first visible sheet.

This is necessary when there are a large number of worksheets and the activated worksheet is not visible on the screen.

  • access: public
void setFirstSheet ()
setFooter (line 842)

Set the page footer caption and optional margin.

  • access: public
void setFooter (string $string, [float $margin = 0.50])
  • string $string: The footer text
  • float $margin: optional foot margin in inches.
setHeader (line 825)

Set the page header caption and optional margin.

  • access: public
void setHeader (string $string, [float $margin = 0.50])
  • string $string: The header text
  • float $margin: optional head margin in inches.
setHPagebreaks (line 1064)

Store the horizontal page breaks on a worksheet (for printing).

The breaks represent the row after which the break is inserted.

  • access: public
void setHPagebreaks (array $breaks)
  • array $breaks: Array containing the horizontal page breaks
setLandscape (line 801)

Set the page orientation as landscape.

  • access: public
void setLandscape ()
setMarginBottom (line 951)

Set the bottom margin in inches.

  • access: public
void setMarginBottom ([float $margin = 1.00])
  • float $margin: The margin to set in inches
setMarginLeft (line 918)

Set the left margin in inches.

  • access: public
void setMarginLeft ([float $margin = 0.75])
  • float $margin: The margin to set in inches
setMarginRight (line 929)

Set the right margin in inches.

  • access: public
void setMarginRight ([float $margin = 0.75])
  • float $margin: The margin to set in inches
setMargins (line 880)

Set all the page margins to the same value in inches.

  • access: public
void setMargins (float $margin)
  • float $margin: The margin to set in inches
setMargins_LR (line 894)

Set the left and right margins to the same value in inches.

  • access: public
void setMargins_LR (float $margin)
  • float $margin: The margin to set in inches
setMargins_TB (line 906)

Set the top and bottom margins to the same value in inches.

  • access: public
void setMargins_TB (float $margin)
  • float $margin: The margin to set in inches
setMarginTop (line 940)

Set the top margin in inches.

  • access: public
void setMarginTop ([float $margin = 1.00])
  • float $margin: The margin to set in inches
setMerge (line 655)

Sets a merged cell range

  • access: public
void setMerge (integer $first_row, integer $first_col, integer $last_row, integer $last_col)
  • integer $first_row: First row of the area to merge
  • integer $first_col: First column of the area to merge
  • integer $last_row: Last row of the area to merge
  • integer $last_col: Last column of the area to merge
setOutline (line 1387)

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

void setOutline ([bool $visible = true], [bool $symbols_below = true], [bool $symbols_right = true], [bool $auto_style = false])
  • bool $visible
  • bool $symbols_below
  • bool $symbols_right
  • bool $auto_style
setPaper (line 812)

Set the paper type. Ex. 1 = US Letter, 9 = A4

  • access: public
void setPaper (integer $size)
  • integer $size: The type of paper size to use
setPortrait (line 791)

Set the page orientation as portrait.

  • access: public
void setPortrait ()
setPrintScale (line 1111)

Set the scale factor for the printed page.

It turns off the "fit to page" option

  • access: public
void setPrintScale ([integer $scale = 100])
  • integer $scale: The optional scale factor. Defaults to 100
setRow (line 2116)

This method is used to set the height and format for a row.

  • access: public
void setRow (integer $row, integer $height, mixed $format, [bool $hidden = false], integer $level)
  • integer $row: The row to set
  • integer $height: Height we are giving to the row. Use NULL to set XF without setting height
  • mixed $format: XF format we are giving to the row
  • bool $hidden: The optional hidden attribute
  • integer $level: The optional outline level for row, in range [0,7]
setSelection (line 747)

Set which cell or cells are selected in a worksheet

  • access: public
void setSelection (integer $first_row, integer $first_column, integer $last_row, integer $last_column)
  • integer $first_row: first row in the selected quadrant
  • integer $first_column: first column in the selected quadrant
  • integer $last_row: last row in the selected quadrant
  • integer $last_column: last column in the selected quadrant
setValidation (line 3487)

FIXME: add comments

void setValidation (mixed $row1, mixed $col1, mixed $row2, mixed $col2, mixed &$validator)
setVPagebreaks (line 1078)

Store the vertical page breaks on a worksheet (for printing).

The breaks represent the column after which the break is inserted.

  • access: public
void setVPagebreaks (array $breaks)
  • array $breaks: Array containing the vertical page breaks
setZoom (line 1092)

Set the worksheet zoom factor.

  • access: public
void setZoom ([integer $scale = 100])
  • integer $scale: The zoom factor
thawPanes (line 780)

Set panes and mark them as unfrozen.

  • access: public
void thawPanes (array $panes)
  • array $panes: This is the only parameter received and is composed of the following:
    1. => Vertical split position,
    2. => Horizontal split position
    3. => Top row visible
    4. => Leftmost column visible
    5. => Active pane
write (line 1135)

Map to the appropriate write method acording to the token recieved.

  • access: public
void write (integer $row, integer $col, mixed $token, mixed $format)
  • integer $row: The row of the cell we are writing to
  • integer $col: The column of the cell we are writing to
  • mixed $token: What we are writing
  • mixed $format: The optional format to apply to the cell
writeBlank (line 1672)

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

  • access: public
void writeBlank (integer $row, integer $col, mixed $format)
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • mixed $format: The XF format
writeCol (line 1217)

Write an array of values as a column

  • return: PEAR_Error on failure
  • access: public
mixed writeCol (integer $row, integer $col, array $val, mixed $format)
  • integer $row: The first row (uppermost row) we are writing to
  • integer $col: The col we are writing to
  • array $val: The array of values to write
  • mixed $format: The optional format to apply to the cell
writeFormula (line 1732)

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

The textual representation of the formula is passed to the parser in Parser.php which returns a packed binary string.

Returns 0 : normal termination -1 : formula errors (bad formula) -2 : row or column out of range

  • access: public
integer writeFormula (integer $row, integer $col, string $formula, mixed $format)
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • string $formula: The formula text string
  • mixed $format: The optional XF format
writeNote (line 1605)

Writes a note associated with the cell given by the row and column.

NOTE records don't have a length limit.

  • access: public
void writeNote (integer $row, integer $col, string $note)
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • string $note: The note to write
writeNumber (line 1422)

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

An integer can be written as a double. Excel will display an integer. $format is optional.

Returns 0 : normal termination -2 : row or column out of range

  • access: public
integer writeNumber (integer $row, integer $col, float $num, mixed $format)
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • float $num: The number to write
  • mixed $format: The optional XF format
writeRow (line 1188)

Write an array of values as a row

  • return: PEAR_Error on failure
  • access: public
mixed writeRow (integer $row, integer $col, array $val, mixed $format)
  • integer $row: The row we are writing to
  • integer $col: The first col (leftmost col) we are writing to
  • array $val: The array of values to write
  • mixed $format: The optional format to apply to the cell
writeString (line 1482)

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

NOTE: there is an Excel 5 defined limit of 255 characters. $format is optional. Returns 0 : normal termination -2 : row or column out of range -3 : long string truncated to 255 chars

  • access: public
integer writeString (integer $row, integer $col, string $str, mixed $format)
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • string $str: The string to write
  • mixed $format: The XF format for the cell
writeStringBIFF8 (line 1534)
void writeStringBIFF8 (mixed $row, mixed $col, mixed $str, mixed $format)
writeUrl (line 1815)

Write a hyperlink.

This is comprised of two elements: the visible label and the invisible link. The visible label is the same as the link unless an alternative string is specified. The label is written using the writeString() method. Therefore the 255 characters string limit applies. $string and $format are optional.

The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external directory url.

Returns 0 : normal termination -2 : row or column out of range -3 : long string truncated to 255 chars

  • access: public
integer writeUrl (integer $row, integer $col, string $url, [string $string = ''], mixed $format)
  • integer $row: Row
  • integer $col: Column
  • string $url: URL string
  • string $string: Alternative label
  • mixed $format: The cell format
_append (line 1263)

Store Worksheet data in memory using the parent's class append() or to a temporary file, the default.

  • access: private
void _append (string $data)
  • string $data: The binary data to append

Redefinition of:
Spreadsheet_Excel_Writer_BIFFwriter::_append()
General storage function
_cellToRowcol (line 1325)

Convert an Excel cell reference in A1 notation to a zero based row and column reference; converts C1 to (0, 2).

  • return: containing (row, column)
  • access: private
array _cellToRowcol (string $cell)
  • string $cell: The cell reference.
_checkRowCol (line 1573)

Check row and col before writing to a cell, and update the sheet's dimensions accordingly

  • return: true for success, false if row and/or col are grester then maximums allowed.
  • access: private
boolean _checkRowCol (integer $row, integer $col)
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
_encodePassword (line 1356)

Based on the algorithm provided by Daniel Rentz of OpenOffice.

  • return: The encoded password
  • access: private
string _encodePassword (string $plaintext)
  • string $plaintext: The password to be encoded in plaintext.
_initialize (line 466)

Open a tmp file to store the majority of the Worksheet data. If this fails, for example due to write permissions, store the data in memory. This can be slow for large files.

  • access: private
void _initialize ()
_positionImage (line 3189)

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: $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2. The width and height of the cells are also variable and have to be taken into account. The values of $col_start and $row_start are passed in from the calling function. The values of $col_end and $row_end 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

  • access: private
void _positionImage (integer $col_start, integer $row_start, integer $x1, integer $y1, integer $width, integer $height)
  • 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
_processBitmap (line 3385)

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.

  • return: Array with data and properties of the bitmap
  • access: private
array _processBitmap (string $bitmap)
  • string $bitmap: The bitmap to process
_sizeCol (line 3254)

Convert the width of a cell from user's units to pixels. By interpolation the relationship is: y = 7x +5. If the width hasn't been set by the user we use the default value. If the col is hidden we use a value of zero.

  • return: The width in pixels
  • access: private
integer _sizeCol (integer $col)
  • integer $col: The column
_sizeRow (line 3280)

Convert the height of a cell from user's units to pixels. By interpolation the relationship is: y = 4/3x. If the height hasn't been set by the user we use the default value. If the row is hidden we use a value of zero. (Not possible to hide row yet).

  • return: The width in pixels
  • access: private
integer _sizeRow (integer $row)
  • integer $row: The row
_storeColinfo (line 2285)

Write BIFF record COLINFO to define column widths

Note: The SDK says the record length is 0x0B but Excel writes a 0x0C length record.

  • access: private
void _storeColinfo (array $col_array)
  • array $col_array: This is the only parameter received and is composed of the following:
    1. => First formatted column,
    2. => Last formatted column,
    3. => Col width (8.43 is Excel default),
    4. => The optional XF format of the column,
    5. => Option flags.
    6. => Optional outline level
_storeDataValidity (line 3498)

Store the DVAL and DV records.

  • access: private
void _storeDataValidity ()
_storeDefcol (line 2259)

Write BIFF record DEFCOLWIDTH if COLINFO records are in use.

  • access: private
void _storeDefcol ()
_storeDimensions (line 2170)

Writes Excel DIMENSIONS to define the area in which there is data.

  • access: private
void _storeDimensions ()
_storeExterncount (line 2415)

Write BIFF record EXTERNCOUNT to indicate the number of external sheet references in a worksheet.

Excel only stores references to external sheets that are used in formulas. For simplicity we store references to all the sheets in the workbook regardless of whether they are used or not. This reduces the overall complexity and eliminates the need for a two way dialogue between the formula parser the worksheet objects.

  • access: private
void _storeExterncount (integer $count)
  • integer $count: The number of external sheet references in this worksheet
_storeExternsheet (line 2434)

Writes the Excel BIFF EXTERNSHEET record. These references are used by formulas. A formula references a sheet name via an index. Since we store a reference to all of the external worksheets the EXTERNSHEET index is the same as the worksheet index.

  • access: private
void _storeExternsheet (string $sheetname)
  • string $sheetname: The name of a external worksheet
_storeFooter (line 2636)

Store the footer caption BIFF record.

  • access: private
void _storeFooter ()
_storeGridset (line 2857)

Write the GRIDSET BIFF record. Must be used in conjunction with the PRINTGRIDLINES record.

  • access: private
void _storeGridset ()
_storeGuts (line 2877)

Write the GUTS BIFF record. This is used to configure the gutter margins where Excel outline symbols are displayed. The visibility of the gutters is controlled by a flag in WSBOOL.

void _storeGuts ()
_storeHbreak (line 2965)

Write the HORIZONTALPAGEBREAKS BIFF record.

  • access: private
void _storeHbreak ()
_storeHcenter (line 2665)

Store the horizontal centering HCENTER BIFF record.

  • access: private
void _storeHcenter ()
_storeHeader (line 2607)

Store the header caption BIFF record.

  • access: private
void _storeHeader ()
_storeMarginBottom (line 2766)

Store the BOTTOMMARGIN BIFF record.

  • access: private
void _storeMarginBottom ()
_storeMarginLeft (line 2700)

Store the LEFTMARGIN BIFF record.

  • access: private
void _storeMarginLeft ()
_storeMarginRight (line 2722)

Store the RIGHTMARGIN BIFF record.

  • access: private
void _storeMarginRight ()
_storeMarginTop (line 2744)

Store the TOPMARGIN BIFF record.

  • access: private
void _storeMarginTop ()
_storeMergedCells (line 2385)

Store the MERGEDCELLS record for all ranges of merged cells

  • access: private
void _storeMergedCells ()
_storeObjPicture (line 3310)

Store the OBJ record that precedes an IMDATA record. This could be generalise to support other Excel objects.

  • access: private
void _storeObjPicture (integer $colL, integer $dxL, integer $rwT, integer $dyT, integer $colR, integer $dxR, integer $rwB, integer $dyB)
  • integer $colL: Column containing upper left corner of object
  • integer $dxL: Distance from left side of cell
  • integer $rwT: Row containing top left corner of object
  • integer $dyT: Distance from top of cell
  • integer $colR: Column containing lower right corner of object
  • integer $dxR: Distance from right of cell
  • integer $rwB: Row containing bottom right corner of object
  • integer $dyB: Distance from bottom of cell
_storePanes (line 2472)

Writes the Excel BIFF PANE record.

The panes can either be frozen or thawed (unfrozen). Frozen panes are specified in terms of an integer number of rows and columns. Thawed panes are specified in terms of Excel's units for rows and columns.

  • access: private
void _storePanes (array $panes)
  • array $panes: This is the only parameter received and is composed of the following:
    1. => Vertical split position,
    2. => Horizontal split position
    3. => Top row visible
    4. => Leftmost column visible
    5. => Active pane
_storePassword (line 3079)

Write the worksheet PASSWORD record.

  • access: private
void _storePassword ()
_storePrintGridlines (line 2839)

Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the GRIDSET record.

  • access: private
void _storePrintGridlines ()
_storePrintHeaders (line 2821)

Write the PRINTHEADERS BIFF record.

  • access: private
void _storePrintHeaders ()
_storeProtect (line 3056)

Set the Biff PROTECT record to indicate that the worksheet is protected.

  • access: private
void _storeProtect ()
_storeSelection (line 2342)

Write BIFF record SELECTION.

void _storeSelection (array $array)
  • array $array: array containing ($rwFirst,$colFirst,$rwLast,$colLast)
_storeSetup (line 2545)

Store the page setup SETUP BIFF record.

  • access: private
void _storeSetup ()
_storeVbreak (line 3010)

Write the VERTICALPAGEBREAKS BIFF record.

  • access: private
void _storeVbreak ()
_storeVcenter (line 2683)

Store the vertical centering VCENTER BIFF record.

  • access: private
void _storeVcenter ()
_storeWindow2 (line 2198)

Write BIFF record Window2.

  • access: private
void _storeWindow2 ()
_storeWsbool (line 2922)

Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction with the SETUP record.

  • access: private
void _storeWsbool ()
_storeZoom (line 3469)

Store the window zoom factor. This should be a reduced fraction but for simplicity we will store all fractions with a numerator of 100.

  • access: private
void _storeZoom ()
_substituteCellref (line 1289)

Substitute an Excel cell reference in A1 notation for zero based row and column values in an argument list.

Ex: ("A4", "Hello") is converted to (3, 0, "Hello").

  • access: private
array _substituteCellref (string $cell)
  • string $cell: The cell reference. Or range of cells.
_writeUrlExternal (line 1995)

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.

integer _writeUrlExternal (integer $row1, integer $col1, integer $row2, integer $col2, string $url, string $str, mixed $format)
  • integer $row1: Start row
  • integer $col1: Start column
  • integer $row2: End row
  • integer $col2: End column
  • string $url: URL string
  • string $str: Alternative label
  • mixed $format: The cell format
_writeUrlInternal (line 1929)

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

integer _writeUrlInternal (integer $row1, integer $col1, integer $row2, integer $col2, string $url, string $str, mixed $format)
  • integer $row1: Start row
  • integer $col1: Start column
  • integer $row2: End row
  • integer $col2: End column
  • string $url: URL string
  • string $str: Alternative label
  • mixed $format: The cell format
_writeUrlRange (line 1839)

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 _writeUrlRange (integer $row1, integer $col1, integer $row2, integer $col2, string $url, [string $string = ''], mixed $format)
  • integer $row1: Start row
  • integer $col1: Start column
  • integer $row2: End row
  • integer $col2: End column
  • string $url: URL string
  • string $string: Alternative label
  • mixed $format: The cell format
_writeUrlWeb (line 1869)

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.

integer _writeUrlWeb (integer $row1, integer $col1, integer $row2, integer $col2, string $url, string $str, mixed $format)
  • integer $row1: Start row
  • integer $col1: Start column
  • integer $row2: End row
  • integer $col2: End column
  • string $url: URL string
  • string $str: Alternative label
  • mixed $format: The cell format
_XF (line 1238)

Returns an index to the XF record in the workbook

  • return: The XF record index
  • access: private
integer _XF (mixed &$format)
  • mixed &$format: The optional XF format

Inherited Methods

Inherited From Spreadsheet_Excel_Writer_BIFFwriter

 Spreadsheet_Excel_Writer_BIFFwriter::Spreadsheet_Excel_Writer_BIFFwriter()
 Spreadsheet_Excel_Writer_BIFFwriter::_addContinue()
 Spreadsheet_Excel_Writer_BIFFwriter::_append()
 Spreadsheet_Excel_Writer_BIFFwriter::_prepend()
 Spreadsheet_Excel_Writer_BIFFwriter::_setByteOrder()
 Spreadsheet_Excel_Writer_BIFFwriter::_storeBof()
 Spreadsheet_Excel_Writer_BIFFwriter::_storeEof()

Documentation generated on Fri, 11 Feb 2005 18:14:39 +0000 by phpDocumentor 1.3.0RC3