Class Spreadsheet_Excel_Writer_Worksheet

Description

Class for generating Excel Spreadsheets

  • author: Xavier Noguer <xnoguer@rezebra.com>
  • version: Release: 1.9.0
  • copyright: 1997-2006 The PHP Group

Located in /web/plugin/feature/sms_excel/lib/external/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
 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 = 0], [integer $y = 0], [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 = null], [integer $hidden = 0], [integer $level = 0])
 void setFirstSheet ()
 void setFooter (string $string, [float $margin = 0.50])
 void setHeader (string $string, [float $margin = 0.50])
 void setHPagebreaks (array $breaks)
 void setInputEncoding (string $encoding)
 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 = 0])
 void setPortrait ()
 void setPrintScale ([integer $scale = 100])
 void setRow (integer $row, integer $height, [mixed $format = null], [bool $hidden = false], [integer $level = 0])
 void setSelection (integer $first_row, integer $first_column, integer $last_row, integer $last_column)
 void setValidation ( $row1,  $col1,  $row2,  $col2,  &$validator)
 void setVPagebreaks (array $breaks)
 void setZoom ([integer $scale = 100])
 void thawPanes (array $panes)
 void write (integer $row, integer $col, mixed $token, [mixed $format = null])
 void writeBlank (integer $row, integer $col, mixed $format)
 mixed writeCol (integer $row, integer $col, array $val, [mixed $format = null])
 integer writeFormula (integer $row, integer $col, string $formula, [mixed $format = null])
 void writeNote (integer $row, integer $col, string $note)
 integer writeNumber (integer $row, integer $col, float $num, [mixed $format = null])
 mixed writeRow (integer $row, integer $col, array $val, [mixed $format = null])
 integer writeString (integer $row, integer $col, string $str, [mixed $format = null])
 integer writeStringBIFF8 (integer $row, integer $col, string $str, [mixed $format = null])
 integer writeUrl (integer $row, integer $col, string $url, [string $string = ''], [mixed $format = null])
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

  • see: _storeDimensions()
integer $_dim_colmin (line 121)

First column for the DIMENSIONS record

  • see: _storeDimensions()
integer $_dim_rowmax (line 114)

Last row for the DIMENSIONS record

  • see: _storeDimensions()
integer $_dim_rowmin (line 107)

First row for the DIMENSIONS record

  • see: _storeDimensions()
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

string $_input_encoding (line 356)

Charset encoding currently used when calling writeString()

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
Spreadsheet_Excel_Writer_BIFFwriter::$_tmp_dir
Methods
activate (line 710)

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

Center the page horinzontally.

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

Center the page vertically.

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

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

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

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

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

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

Retrieve the worksheet name.

This is usefull when creating worksheets without a name.

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

Set the option to hide gridlines on the printed page.

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

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

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

Insert a 24bit bitmap image in a worksheet.

  • access: public
void insertBitmap (integer $row, integer $col, string $bitmap, [integer $x = 0], [integer $y = 0], [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 2802)

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

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

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

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

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

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

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

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

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

  • access: public
void setColumn (integer $firstcol, integer $lastcol, integer $width, [mixed $format = null], [integer $hidden = 0], [integer $level = 0])
  • 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 723)

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

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

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

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
setInputEncoding (line 1534)

Sets Input Encoding for writing strings

  • access: public
void setInputEncoding (string $encoding)
  • string $encoding: The encoding. Ex: 'UTF-16LE', 'utf-8', 'ISO-859-7'
setLandscape (line 828)

Set the page orientation as landscape.

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

Set the bottom margin in inches.

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

Set the left margin in inches.

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

Set the right margin in inches.

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

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

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

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

Set the top margin in inches.

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

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

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

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

  • access: public
void setPaper ([integer $size = 0])
  • integer $size: The type of paper size to use
setPortrait (line 818)

Set the page orientation as portrait.

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

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

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

  • access: public
void setRow (integer $row, integer $height, [mixed $format = null], [bool $hidden = false], [integer $level = 0])
  • 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 774)

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 ( $row1,  $col1,  $row2,  $col2,  &$validator)
  • $row1
  • $col1
  • $row2
  • $col2
  • &$validator
setVPagebreaks (line 1103)

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

Set the worksheet zoom factor.

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

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

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

  • access: public
void write (integer $row, integer $col, mixed $token, [mixed $format = null])
  • 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 1702)

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

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 = null])
  • 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 1755)

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 = null])
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • string $formula: The formula text string
  • mixed $format: The optional XF format
writeNote (line 1642)

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

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 = null])
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • float $num: The number to write
  • mixed $format: The optional XF format
writeRow (line 1200)

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 = null])
  • 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 1483)

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 = null])
  • 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 1557)

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

This is the BIFF8 version (no 255 chars limit). $format is optional. Returns 0 : normal termination -2 : row or column out of range -3 : long string truncated to 255 chars

  • access: public
integer writeStringBIFF8 (integer $row, integer $col, string $str, [mixed $format = null])
  • integer $row: Zero indexed row
  • integer $col: Zero indexed column
  • string $str: The string to write
  • mixed $format: The XF format for the cell
writeUrl (line 1833)

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 = null])
  • integer $row: Row
  • integer $col: Column
  • string $url: URL string
  • string $string: Alternative label
  • mixed $format: The cell format

Inherited Methods

Inherited From Spreadsheet_Excel_Writer_BIFFwriter

 Spreadsheet_Excel_Writer_BIFFwriter::Spreadsheet_Excel_Writer_BIFFwriter()
 Spreadsheet_Excel_Writer_BIFFwriter::setTempDir()

Inherited From PEAR

 PEAR::PEAR()
 PEAR::delExpect()
 PEAR::expectError()
 PEAR::getStaticProperty()
 PEAR::isError()
 PEAR::loadExtension()
 PEAR::popErrorHandling()
 PEAR::popExpect()
 PEAR::pushErrorHandling()
 PEAR::raiseError()
 PEAR::registerShutdownFunc()
 PEAR::setErrorHandling()
 PEAR::staticPopErrorHandling()
 PEAR::staticPushErrorHandling()
 PEAR::throwError()
 PEAR::_PEAR()

Documentation generated on Wed, 09 Feb 2011 09:05:45 +0700 by phpDocumentor 1.4.2