Class Spreadsheet

Description

Streams data in the BIFF (Binary Interchange File Format) format

The BIFF format can be read by applications like MS Excel and OpenOffice.org. The class is compliant with BIFF version 2.1.

Located in /core/util/Spreadsheet.class.php (line 96)

PHP2Go
   |
   --Spreadsheet
Variable Summary
Method Summary
int addCellFormat ([array $properties = array()])
bool addCellNote (int $row, int $col, string $value)
int addFont (array $properties)
void addHorizontalBreak (int $row)
int addPictureString (string $picString)
void addVerticalBreak (int $col)
void download (string $fileName, [string $mimeType = ''])
void freezePanes (int $width, int $height, [int $leftCol = NULL], [int $topRow = NULL])
void protectSheet (string $password)
void setBackup (bool $flag)
void setBottomMargin (float $margin)
void setColWidth (int $width, int $colStart, [int $colEnd = NULL])
void setFooter ( $footer, [float $margin = 0.50], string $header)
void setHeader (string $header, [float $margin = 0.50])
void setLeftMargin (float $margin)
void setMargin (float $margin)
void setPrintGridlines (bool $flag)
void setPrintHeaders (bool $flag)
void setRightMargin (float $margin)
void setRowHeight (int $height, int $rowStart, [int $rowEnd = NULL])
void setSelection (int $firstRow, int $firstCol, int $lastRow, int $lastCol)
void setTopMargin (float $margin)
bool toFile (string $fileName, [int $fileMode = NULL])
void writeArray (int $row, array $array, [int $columnWidth = 0], [int $font = 0], [int $format = 0], [int $startCol = 0])
bool writeBlank (int $row, int $col, [int $columnWidth = 0], [int $format = 0])
bool writeData (int $row, int $col, mixed $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
bool writeDateTime (int $row, int $col, string $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
bool writeNumber (int $row, int $col, int|float $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
bool writeString (int $row, int $col, string $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
void _adjustColWidth (int $col, int $colWidth, int $len)
void _appendStream (string $value)
int _buildFormat (array $properties)
bool _checkBounds (int $row, int $col)
string _encodeSheetPasswd (string $password)
void _getByteOrder ()
void _writeBackup ()
void _writeBreaks ()
void _writeCodePage ()
void _writeColInfo ()
string _writeContinue (string $data)
void _writeEndOfFile ()
void _writeFonts ()
void _writeFooter ()
void _writeHeader ()
void _writeMargins ()
void _writePanes ()
void _writePictures ()
void _writeProtect ()
void _writeRowInfo ()
void _writeSelection ()
void _writeWindow1 ()
void _writeWindow2 ()
void _writeWsBool ()
Variables
int $activePane (line 359)

Active frozen pane

  • access: private
bool $backup = FALSE (line 191)

Backup flag

  • access: private
float $bottomMargin = 0.50 (line 271)

Bottom margin

  • access: private
int $byteOrder = SPRSH_LITTLE_ENDIAN (line 135)

Byte order

  • access: private
array $cellFormats (line 375)

Cell formats

  • access: private
array $colInfo = array() (line 223)

Holds customized cell widths

  • access: private
string $dataStream = '' (line 119)

Cell data stream

  • access: private
int $datePicture (line 391)

Date picture

  • access: public
int $dateTimePicture (line 399)

Datetime picture

  • access: public
float $defaultColWidth = 8.43 (line 199)

Default cell width

  • access: private
float $defaultRowHeight = 12.75 (line 207)

Default row height

  • access: private
array $fonts (line 367)

Cell fonts

  • access: private
string $footer = '' (line 295)

Footer text

  • access: private
float $footerMargin = 0.50 (line 303)

Footer margin

  • access: private
bool $freeze = TRUE (line 343)

Indicates if the spreadsheet contains frozen panes

  • access: private
string $header = '' (line 279)

Header text

  • access: private
float $headerMargin = 0.50 (line 287)

Header margin

  • access: private
array $horizontalBreaks = array() (line 311)

Horizontal page breaks

  • access: private
float $leftMargin = 0.50 (line 247)

Left margin

  • access: private
int $maxColDimension (line 167)

Max col dimension

  • access: private
int $maxRowDimension (line 151)

Max row dimension

  • access: private
int $minColDimension (line 159)

Min col dimension

  • access: private
int $minRowDimension (line 143)

Min row dimension

  • access: private
string $noteStream = '' (line 127)

Cell notes stream

  • access: private
array $panes = array(0, 0, 0, 0) (line 351)

Frozen panes

  • access: private
array $pictures = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') (line 383)

Cell picures

  • access: private
bool $printGridLines = TRUE (line 239)

Print grid lines flag

  • access: private
bool $printHeaders = TRUE (line 231)

Print headers flag

  • access: private
bool $protectBool = FALSE (line 175)

Whether the spreadsheet should be protected with a password

  • access: private
string $protectPasswd (line 183)

Spreadsheet's password

  • access: private
float $rightMargin = 0.50 (line 255)

Right margin

  • access: private
array $rowInfo = array() (line 215)

Holds customized row heights

  • access: private
bool $selected = FALSE (line 327)

Indicates if the spreadsheet contains a selected area

  • access: private
array $selection = array(0, 0, 0, 0) (line 335)

Selection area

  • access: private
string $stream = '' (line 111)

Binary stream

  • access: private
bool $throwErrors = TRUE (line 103)

Whether errors should be thrown

float $topMargin = 0.50 (line 263)

Top margin

  • access: private
array $verticalBreaks = array() (line 319)

Vertical page breaks

  • access: private
Methods
Constructor Spreadsheet (line 406)

Class constructor

Spreadsheet Spreadsheet ()
addCellFormat (line 468)

Adds a new cell format

Formatting options: align, fill, shaded, box_border, left_border, right_border, top_border, bottom_border, locked and hidden.

  1.  $boxBorder $xls->addCellFormat(array('align' => 'left''box_border' => TRUE));

  • return: New format index
int addCellFormat ([array $properties = array()])
  • array $properties: Formatting options
addCellNote (line 917)

Adds a note on a given position

bool addCellNote (int $row, int $col, string $value)
  • int $row: Row index
  • int $col: Column index
  • string $value: Cell note
addFont (line 436)

Adds a new cell font

Font properties: name, size, bold, italic, underline and strikeout.

  1.  $arialBold $xls->addFont(array('name' => 'Arial''bold' => TRUE));

  • return: New font index
int addFont (array $properties)
  • array $properties: Font properties
addHorizontalBreak (line 646)

Adds an horizontal page break

void addHorizontalBreak (int $row)
  • int $row: Row index
addPictureString (line 484)

Adds a new cell picture

  • return: New picture index
int addPictureString (string $picString)
  • string $picString: Cell picture
addVerticalBreak (line 657)

Adds a vertical page break

void addVerticalBreak (int $col)
  • int $col: Column index
download (line 947)

Sends the proper download headers and flushes the spreadsheet contents

void download (string $fileName, [string $mimeType = ''])
  • string $fileName: File name
  • string $mimeType: MIME type
freezePanes (line 688)

Adds a frozen pane

void freezePanes (int $width, int $height, [int $leftCol = NULL], [int $topRow = NULL])
  • int $width: Width (number of columns)
  • int $height: Height (number of rows)
  • int $leftCol: First visible column on left side
  • int $topRow: First visible row on top side
protectSheet (line 495)

Protects the spreadsheet with a password

void protectSheet (string $password)
  • string $password: Password
setBackup (line 505)

Enable/disable backup flag

void setBackup (bool $flag)
  • bool $flag: Flag value
setBottomMargin (line 637)

Set bottom margin

void setBottomMargin (float $margin)
  • float $margin: Bottom margin
setColWidth (line 535)

Set the width of a column or a range of columns

void setColWidth (int $width, int $colStart, [int $colEnd = NULL])
  • int $width: New width
  • int $colStart: Column index
  • int $colEnd: End column index
setFooter (line 586)

Set contents and margin of the spreadsheet footer

The margin values must be expressed in inches.

void setFooter ( $footer, [float $margin = 0.50], string $header)
  • string $header: Text
  • float $margin: Margin
  • $footer
setHeader (line 573)

Set contents and margin of the spreadsheet header

The margin values must be expressed in inches.

void setHeader (string $header, [float $margin = 0.50])
  • string $header: Text
  • float $margin: Margin
setLeftMargin (line 610)

Set left margin

void setLeftMargin (float $margin)
  • float $margin: Left margin
setMargin (line 598)

Set a single value to all spreadsheet margins

The margin values must be expressed in inches.

void setMargin (float $margin)
  • float $margin
setPrintGridlines (line 561)

Enable/disable printing of grid lines

void setPrintGridlines (bool $flag)
  • bool $flag: Flag value
setPrintHeaders (line 552)

Enable/disable printing of headers

void setPrintHeaders (bool $flag)
  • bool $flag: Flag value
setRightMargin (line 619)

Set right margin

void setRightMargin (float $margin)
  • float $margin: Right margin
setRowHeight (line 516)

Set the height of a row or a range of rows

void setRowHeight (int $height, int $rowStart, [int $rowEnd = NULL])
  • int $height: New height
  • int $rowStart: Row index
  • int $rowEnd: End row index
setSelection (line 671)

Set selection area

void setSelection (int $firstRow, int $firstCol, int $lastRow, int $lastCol)
  • int $firstRow: First row
  • int $firstCol: First column
  • int $lastRow: Last row
  • int $lastCol: Last column
setTopMargin (line 628)

Set top margin

void setTopMargin (float $margin)
  • float $margin: Top margin
toFile (line 963)

Renders and saves the spreadsheet contents to a file

bool toFile (string $fileName, [int $fileMode = NULL])
  • string $fileName: File name
  • int $fileMode: File mode
writeArray (line 891)

Writes an array of values on a given row

The method determines data type by calling http://www.php.net/gettype for each array entry.

void writeArray (int $row, array $array, [int $columnWidth = 0], [int $font = 0], [int $format = 0], [int $startCol = 0])
  • int $row: Row index
  • array $array: Array of values
  • int $columnWidth: Column width
  • int $font: Font index
  • int $format: Format index
  • int $startCol: Index of the start column
writeBlank (line 863)

Writes a blank string on a given position

bool writeBlank (int $row, int $col, [int $columnWidth = 0], [int $format = 0])
  • int $row: Row index
  • int $col: Column index
  • int $columnWidth: Column width
  • int $format: Format index
writeData (line 710)

Writes data on a given position

bool writeData (int $row, int $col, mixed $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
  • int $row: Row index
  • int $col: Column index
  • mixed $value: Value
  • int $columnWidth: Column width
  • int $picture: Picture index
  • int $font: Font index
  • int $format: Format index
writeDateTime (line 777)

Writes a datetime value on a given position

bool writeDateTime (int $row, int $col, string $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
  • int $row: Row index
  • int $col: Column index
  • string $value: Datetime value
  • int $columnWidth: Column width
  • int $picture: Picture index
  • int $font: Font index
  • int $format: Format index
writeNumber (line 741)

Writes a numeric value on a given position

bool writeNumber (int $row, int $col, int|float $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
  • int $row: Row index
  • int $col: Column index
  • int|float $value: Numeric value
  • int $columnWidth: Column width
  • int $picture: Picture index
  • int $font: Font index
  • int $format: Format index
writeString (line 831)

Writes a string on a given position

bool writeString (int $row, int $col, string $value, [int $columnWidth = 0], [int $picture = 0], [int $font = 0], [int $format = 0])
  • int $row: Row index
  • int $col: Column index
  • string $value: Value to be written
  • int $columnWidth: Column width
  • int $picture: Picture index
  • int $font: Font index
  • int $format: Format index
_adjustColWidth (line 1154)

Rebuilds the column width based on the length of inserted values

  • access: private
void _adjustColWidth (int $col, int $colWidth, int $len)
  • int $col: Column index
  • int $colWidth: Desired column width
  • int $len: Value length: defines the minimum width
_appendStream (line 1016)

Appends a value in the spreadsheet's binary stream

  • access: private
void _appendStream (string $value)
  • string $value: Value to append
_buildFormat (line 1048)

Builds a hash from the properties of a cell format

  • return: Hash
  • access: private
int _buildFormat (array $properties)
  • array $properties: Cell format properties
_checkBounds (line 1130)

Checks if a row/column pair respects the spreadsheet limits

  • access: private
bool _checkBounds (int $row, int $col)
  • int $row: Row index
  • int $col: Column index
_encodeSheetPasswd (line 1104)

Encodes the spreadsheet's password

  • return: Encoded password
  • access: private
string _encodeSheetPasswd (string $password)
  • string $password: Plain text password
_getByteOrder (line 1030)

Checks the floating point format of the server

  • access: private
void _getByteOrder ()
_prepareSpreadsheet (line 984)

Renders spreadsheet's binary stream

void _prepareSpreadsheet ()
_writeBackup (line 1224)

Writes the BACKUP record

  • access: private
void _writeBackup ()
_writeBeginOfFile (line 1200)

Writes BOF (begin of file) record

  • access: private
void _writeBeginOfFile ()
_writeBreaks (line 1261)

Writes the HBREAK and VBREAK records

  • access: private
void _writeBreaks ()
_writeCodePage (line 1213)

Writes the CODEPAGE record

  • access: private
void _writeCodePage ()
_writeColInfo (line 1383)

Writes the records containing the column widths

  • access: private
void _writeColInfo ()
_writeContinue (line 1179)

Writes a sequence of CONTINUE records

Write a sequence of blocks of 2080 bytes to allow records greater than the limit imposed by the BIFF 2.1 format.

  • access: private
string _writeContinue (string $data)
  • string $data: Block data
_writeDefaultRowHeight (line 1289)

Writes the DEFAULTROWHEIGHT record

  • access: private
void _writeDefaultRowHeight ()
_writeEndOfFile (line 1535)

Writes the EOF (end of file) record

  • access: private
void _writeEndOfFile ()
_writeFonts (line 1312)

Writes the cell fonts

  • access: private
void _writeFonts ()
_writeFooter (line 1350)

Writes the FOOTER record

  • access: private
void _writeFooter ()
_writeHeader (line 1338)

Writes the HEADER record

  • access: private
void _writeHeader ()
_writeMargins (line 1362)

Writes the LEFTMARGIN, RIGHTMARGIN, TOPMARGIN and BOTTOMMARGIN records

  • access: private
void _writeMargins ()
_writePanes (line 1508)

Writes the PANE record

  • access: private
void _writePanes ()
_writePictures (line 1396)

Writes the cell pictures

  • access: private
void _writePictures ()
_writePrintGridLines (line 1250)

Writes the PRINTGRIDLINES record

  • access: private
void _writePrintGridLines ()
_writePrintHeaders (line 1239)

Writes the PRINTROWHEADERS record

  • access: private
void _writePrintHeaders ()
_writeProtect (line 1430)

Writes the protection password, if enabled

  • access: private
void _writeProtect ()
_writeRowInfo (line 1414)

Writes the row heights

  • access: private
void _writeRowInfo ()
_writeSelection (line 1494)

Writes the SELECTION record

  • access: private
void _writeSelection ()
_writeWindow1 (line 1450)

Writes the WINDOW1 record

  • access: private
void _writeWindow1 ()
_writeWindow2 (line 1473)

Writes the WINDOW2 record

  • access: private
void _writeWindow2 ()
_writeWsBool (line 1300)

Writes the WSBOOL record

  • access: private
void _writeWsBool ()

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:29:43 -0300 by phpDocumentor 1.3.2