Spreadsheet_Excel_Writer
[ class tree: Spreadsheet_Excel_Writer ] [ index: Spreadsheet_Excel_Writer ] [ all elements ]

Class: Spreadsheet_Excel_Writer_Worksheet

Source Location: /Spreadsheet_Excel_Writer-0.9.3/Spreadsheet/Excel/Writer/Worksheet.php

Class Overview

PEAR
   |
   --Spreadsheet_Excel_Writer_BIFFwriter
      |
      --Spreadsheet_Excel_Writer_Worksheet

Class for generating Excel Spreadsheets


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 46]
Class for generating Excel Spreadsheets


[ Top ]


Class Variables

$index =

[line 58]

Index for the Worksheet

Type:   integer


[ Top ]

$name =

[line 52]

Name of the Worksheet

Type:   string


[ Top ]

$print_colmax =

[line 278]

Last column of the area to print

Type:   integer


[ Top ]

$print_colmin =

[line 272]

First column of the area to print

Type:   integer


[ Top ]

$print_rowmax =

[line 266]

Last row to of the area to print

Type:   integer


[ Top ]

$print_rowmin =

[line 260]

First row of the area to print

Type:   integer


[ Top ]

$selected =

[line 164]

Bit specifying if the worksheet is selected

Type:   integer


[ Top ]

$title_colmin =

[line 254]

First column to reapeat on each printed page

Type:   integer


[ Top ]

$title_rowmax =

[line 248]

Last row to reapeat on each printed page

Type:   integer


[ Top ]

$title_rowmin =

[line 242]

First row to reapeat on each printed page

Type:   integer


[ Top ]



Method Detail

activate   [line 749]

void activate( )

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

[ Top ]

centerHorizontally   [line 948]

void centerHorizontally( [integer $center = 1])

Center the page horinzontally.
  • Access: public

Parameters:

integer   $center   —  the optional value for centering. Defaults to 1 (center).

[ Top ]

centerVertically   [line 959]

void centerVertically( [integer $center = 1])

Center the page vertically.
  • Access: public

Parameters:

integer   $center   —  the optional value for centering. Defaults to 1 (center).

[ Top ]

close   [line 538]

void close( array $sheetnames)

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

Parameters:

array   $sheetnames   —  The array of sheetnames from the Workbook this worksheet belongs to

[ Top ]

fitToPages   [line 1138]

void fitToPages( integer $width, integer $height)

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

It doesn't seem to work with OpenOffice.


Parameters:

integer   $width   —  Maximun width of printed area in pages
integer   $height   —  Maximun heigth of printed area in pages

[ Top ]

freezePanes   [line 853]

void freezePanes( array $panes)

Set panes and mark them as frozen.
  • Access: public

Parameters:

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

[ Top ]

getData   [line 678]

string getData( )

Retrieves data from memory in one chunk, or from disk in $buffer sized chunks.
  • Return: The data

[ Top ]

getName   [line 667]

string getName( )

Retrieve the worksheet name.

This is usefull when creating worksheets without a name.

  • Return: The worksheet's name
  • Access: public

[ Top ]

hideGridlines   [line 1103]

void hideGridlines( )

Set the option to hide gridlines on the printed page.
  • Access: public

[ Top ]

hideScreenGridlines   [line 1113]

void hideScreenGridlines( )

Set the option to hide gridlines on the worksheet (as seen on the screen).
  • Access: public

[ Top ]

insertBitmap   [line 3189]

void insertBitmap( integer $row, integer $col, string $bitmap, [integer $x = 0], [integer $y = 0], [integer $scale_x = 1], [integer $scale_y = 1])

Insert a 24bit bitmap image in a worksheet.
  • Access: public

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

[ Top ]

mergeCells   [line 2877]

void mergeCells( integer $first_row, integer $first_col, integer $last_row, integer $last_col)

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

Parameters:

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

[ Top ]

printArea   [line 1089]

void printArea( integer $first_row, integer $first_col, integer $last_row, integer $last_col)

Set the area of each worksheet that will be printed.
  • Access: public

Parameters:

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

[ Top ]

printRowColHeaders   [line 1124]

void printRowColHeaders( [integer $print = 1])

Set the option to print the row and column headers on the printed page.
  • Access: public

Parameters:

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

[ Top ]

protect   [line 775]

void protect( string $password)

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

Parameters:

string   $password   —  The password to use for protecting the sheet.

[ Top ]

repeatColumns   [line 1070]

void repeatColumns( integer $first_col, [integer $last_col = null])

Set the columns to repeat at the left hand side of each printed page.
  • Access: public

Parameters:

integer   $first_col   —  First column to repeat
integer   $last_col   —  Last column to repeat. Optional.

[ Top ]

repeatRows   [line 1053]

void repeatRows( integer $first_row, [integer $last_row = null])

Set the rows to repeat at the top of each printed page.
  • Access: public

Parameters:

integer   $first_row   —  First row to repeat
integer   $last_row   —  Last row to repeat. Optional.

[ Top ]

select   [line 737]

void select( )

Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.
  • Access: public

[ Top ]

setColumn   [line 792]

void setColumn( integer $firstcol, integer $lastcol, integer $width, [mixed $format = null], [integer $hidden = 0], [integer $level = 0])

Set the width of a single column or a range of columns.
  • Access: public

Parameters:

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

[ Top ]

setFirstSheet   [line 762]

void setFirstSheet( )

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

[ Top ]

setFooter   [line 932]

void setFooter( string $string, [float $margin = 0.50])

Set the page footer caption and optional margin.
  • Access: public

Parameters:

string   $string   —  The footer text
float   $margin   —  optional foot margin in inches.

[ Top ]

setHeader   [line 915]

void setHeader( string $string, [float $margin = 0.50])

Set the page header caption and optional margin.
  • Access: public

Parameters:

string   $string   —  The header text
float   $margin   —  optional head margin in inches.

[ Top ]

setHPagebreaks   [line 1152]

void setHPagebreaks( array $breaks)

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

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

  • Access: public

Parameters:

array   $breaks   —  Array containing the horizontal page breaks

[ Top ]

setInputEncoding   [line 1607]

void setInputEncoding( string $encoding)

Sets Input Encoding for writing strings
  • Access: public

Parameters:

string   $encoding   —  The encoding. Ex: 'UTF-16LE', 'utf-8', 'ISO-859-7'

[ Top ]

setLandscape   [line 891]

void setLandscape( )

Set the page orientation as landscape.
  • Access: public

[ Top ]

setMarginBottom   [line 1041]

void setMarginBottom( [float $margin = 1.00])

Set the bottom margin in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMarginLeft   [line 1008]

void setMarginLeft( [float $margin = 0.75])

Set the left margin in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMarginRight   [line 1019]

void setMarginRight( [float $margin = 0.75])

Set the right margin in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMargins   [line 970]

void setMargins( float $margin)

Set all the page margins to the same value in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMargins_LR   [line 984]

void setMargins_LR( float $margin)

Set the left and right margins to the same value in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMargins_TB   [line 996]

void setMargins_TB( float $margin)

Set the top and bottom margins to the same value in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMarginTop   [line 1030]

void setMarginTop( [float $margin = 1.00])

Set the top margin in inches.
  • Access: public

Parameters:

float   $margin   —  The margin to set in inches

[ Top ]

setMerge   [line 712]

void setMerge( integer $first_row, integer $first_col, integer $last_row, integer $last_col)

Sets a merged cell range
  • Access: public

Parameters:

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

[ Top ]

setOutline   [line 1458]

void 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   — 

[ Top ]

setPaper   [line 902]

void setPaper( [integer $size = 0])

Set the paper type. Ex. 1 = US Letter, 9 = A4
  • Access: public

Parameters:

integer   $size   —  The type of paper size to use

[ Top ]

setPortrait   [line 881]

void setPortrait( )

Set the page orientation as portrait.
  • Access: public

[ Top ]

setPrintScale   [line 1198]

void setPrintScale( [integer $scale = 100])

Set the scale factor for the printed page.

It turns off the "fit to page" option

  • Access: public

Parameters:

integer   $scale   —  The optional scale factor. Defaults to 100

[ Top ]

setRow   [line 2216]

void setRow( integer $row, integer $height, [mixed $format = null], [bool $hidden = false], [integer $level = 0])

This method is used to set the height and format for a row.
  • Access: public

Parameters:

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]

[ Top ]

setRTL   [line 1476]

void setRTL( [bool $rtl = true])

This method sets the worksheet direction to right-to-left (RTL)

Parameters:

bool   $rtl   — 

[ Top ]

setSelection   [line 837]

void setSelection( integer $first_row, integer $first_column, integer $last_row, integer $last_column)

Set which cell or cells are selected in a worksheet
  • Access: public

Parameters:

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

[ Top ]

setValidation   [line 3562]

void setValidation( $row1, $col1, $row2, $col2, &$validator)

FIXME: add comments

Parameters:

   $row1   — 
   $col1   — 
   $row2   — 
   $col2   — 
   &$validator   — 

[ Top ]

setVPagebreaks   [line 1166]

void setVPagebreaks( array $breaks)

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

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

  • Access: public

Parameters:

array   $breaks   —  Array containing the vertical page breaks

[ Top ]

setZoom   [line 1180]

void setZoom( [integer $scale = 100])

Set the worksheet zoom factor.
  • Access: public

Parameters:

integer   $scale   —  The zoom factor

[ Top ]

thawPanes   [line 870]

void thawPanes( array $panes)

Set panes and mark them as unfrozen.
  • Access: public

Parameters:

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

[ Top ]

write   [line 1221]

void write( integer $row, integer $col, mixed $token, [mixed $format = null])

Map to the appropriate write method acording to the token recieved.
  • Access: public

Parameters:

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

[ Top ]

writeBlank   [line 1775]

void writeBlank( integer $row, integer $col, mixed $format)

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

Parameters:

integer   $row   —  Zero indexed row
integer   $col   —  Zero indexed column
mixed   $format   —  The XF format

[ Top ]

writeCol   [line 1292]

mixed writeCol( integer $row, integer $col, array $val, [mixed $format = null])

Write an array of values as a column
  • Return: PEAR_Error on failure
  • Access: public

Parameters:

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

[ Top ]

writeFormula   [line 1828]

integer writeFormula( integer $row, integer $col, string $formula, [mixed $format = null])

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

Parameters:

integer   $row   —  Zero indexed row
integer   $col   —  Zero indexed column
string   $formula   —  The formula text string
mixed   $format   —  The optional XF format

[ Top ]

writeNote   [line 1715]

void writeNote( integer $row, integer $col, string $note)

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

NOTE records don't have a length limit.

  • Access: public

Parameters:

integer   $row   —  Zero indexed row
integer   $col   —  Zero indexed column
string   $note   —  The note to write

[ Top ]

writeNumber   [line 1503]

integer writeNumber( integer $row, integer $col, float $num, [mixed $format = null])

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

Parameters:

integer   $row   —  Zero indexed row
integer   $col   —  Zero indexed column
float   $num   —  The number to write
mixed   $format   —  The optional XF format

[ Top ]

writeRow   [line 1263]

mixed writeRow( integer $row, integer $col, array $val, [mixed $format = null])

Write an array of values as a row
  • Return: PEAR_Error on failure
  • Access: public

Parameters:

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

[ Top ]

writeString   [line 1556]

integer writeString( integer $row, integer $col, string $str, [mixed $format = null])

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

Parameters:

integer   $row   —  Zero indexed row
integer   $col   —  Zero indexed column
string   $str   —  The string to write
mixed   $format   —  The XF format for the cell

[ Top ]

writeStringBIFF8   [line 1630]

integer writeStringBIFF8( integer $row, integer $col, string $str, [mixed $format = null])

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

Parameters:

integer   $row   —  Zero indexed row
integer   $col   —  Zero indexed column
string   $str   —  The string to write
mixed   $format   —  The XF format for the cell

[ Top ]

writeUrl   [line 1906]

integer writeUrl( integer $row, integer $col, string $url, [string $string = ''], [mixed $format = null])

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

Parameters:

integer   $row   —  Row
integer   $col   —  Column
string   $url   —  URL string
string   $string   —  Alternative label
mixed   $format   —  The cell format

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:17 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.