Overview

Packages

  • JAMA
  • None
  • PHP
  • PHPExcel
    • CachedObjectStorage
    • Calculation
    • Cell
    • Chart
      • Renderer
    • Reader
      • Excel2007
      • Excel5
    • RichText
    • Settings
    • Shared
      • Escher
      • OLE
      • Trend
      • ZipArchive
    • Style
    • Worksheet
      • Drawing
    • Writer
      • 2007
      • CSV
      • Excel2007
      • Excel5
      • HTML
      • PDF

Classes

  • PHPExcel_Writer_Excel5
  • PHPExcel_Writer_Excel5_BIFFwriter
  • PHPExcel_Writer_Excel5_Escher
  • PHPExcel_Writer_Excel5_Font
  • PHPExcel_Writer_Excel5_Parser
  • PHPExcel_Writer_Excel5_Workbook
  • PHPExcel_Writer_Excel5_Worksheet
  • PHPExcel_Writer_Excel5_Xf
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download

Class PHPExcel_Writer_Excel5_Parser

PHPExcel_Writer_Excel5_Parser

Package: PHPExcel\Writer\Excel5
Category: PHPExcel
Copyright: Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
License: LGPL
Located at controlador/include/phpexcel/PHPExcel/Writer/Excel5/Parser.php
Methods summary
public
# __construct( )

The class constructor

The class constructor

public
# _initializeHashes( )

Initialize the ptg and function hashes.

Initialize the ptg and function hashes.

public mixed
# _convert( mixed $token )

Convert a token to the proper ptg value.

Convert a token to the proper ptg value.

Parameters

$token
The token to convert.

Returns

mixed
the converted token on success
public
# _convertNumber( mixed $num )

Convert a number token to ptgInt or ptgNum

Convert a number token to ptgInt or ptgNum

Parameters

$num
an integer or double for conversion to its ptg value
public mixed
# _convertString( string $string )

Convert a string token to ptgStr

Convert a string token to ptgStr

Parameters

$string
A string for conversion to its ptg value.

Returns

mixed
the converted token on success
public string
# _convertFunction( string $token, integer $num_args )

Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes.

Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes.

Parameters

$token
The name of the function for convertion to ptg value.
$num_args
The number of arguments the function receives.

Returns

string
The packed ptg for the function
public
# _convertRange2d( string $range, integer $class = 0 )

Convert an Excel range such as A1:D4 to a ptgRefV.

Convert an Excel range such as A1:D4 to a ptgRefV.

Parameters

$range
An Excel range in the A1:A2
$class
public mixed
# _convertRange3d( string $token )

Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d.

Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d.

Parameters

$token
An Excel range in the Sheet1!A1:A2 format.

Returns

mixed
The packed ptgArea3d token on success.
public string
# _convertRef2d( string $cell )

Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.

Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.

Parameters

$cell
An Excel cell reference

Returns

string
The cell in packed() format with the corresponding ptg
public mixed
# _convertRef3d( string $cell )

Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d.

Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d.

Parameters

$cell
An Excel cell reference

Returns

mixed
The packed ptgRef3d token on success.
public string
# _convertError( string $errorCode )

Convert an error code to a ptgErr

Convert an error code to a ptgErr

Parameters

$errorCode
The error code for conversion to its ptg value

Returns

string
The error code ptgErr
public string
# _packExtRef( string $ext_ref )

Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure.

Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure.

Parameters

$ext_ref
The name of the external reference

Returns

string
The reference index in packed() format
public mixed
# _getRefIndex( string $ext_ref )

Look up the REF index that corresponds to an external sheet name (or range). If it doesn't exist yet add it to the workbook's references array. It assumes all sheet names given must exist.

Look up the REF index that corresponds to an external sheet name (or range). If it doesn't exist yet add it to the workbook's references array. It assumes all sheet names given must exist.

Parameters

$ext_ref
The name of the external reference

Returns

mixed
The reference index in packed() format on success
public integer
# _getSheetIndex( string $sheet_name )

Look up the index that corresponds to an external sheet name. The hash of sheet names is updated by the addworksheet() method of the PHPExcel_Writer_Excel5_Workbook class.

Look up the index that corresponds to an external sheet name. The hash of sheet names is updated by the addworksheet() method of the PHPExcel_Writer_Excel5_Workbook class.

Parameters

$sheet_name
Sheet name

Returns

integer
The sheet index, -1 if the sheet was not found
public
# setExtSheet( string $name, integer $index )

This method is used to update the array of sheet names. It is called by the addWorksheet() method of the PHPExcel_Writer_Excel5_Workbook class.

This method is used to update the array of sheet names. It is called by the addWorksheet() method of the PHPExcel_Writer_Excel5_Workbook class.

Parameters

$name
The name of the worksheet being added
$index
The index of the worksheet being added

See

PHPExcel_Writer_Excel5_Workbook::addWorksheet()
public array
# _cellToPackedRowcol( string $cell )

pack() row and column into the required 3 or 4 byte format.

pack() row and column into the required 3 or 4 byte format.

Parameters

$cell
The Excel cell reference to be packed

Returns

array
Array containing the row and column in packed() format
public array
# _rangeToPackedRange( string $range )

pack() row range into the required 3 or 4 byte format. Just using maximum col/rows, which is probably not the correct solution

pack() row range into the required 3 or 4 byte format. Just using maximum col/rows, which is probably not the correct solution

Parameters

$range
The Excel range to be packed

Returns

array
Array containing (row1,col1,row2,col2) in packed() format
public array
# _cellToRowcol( string $cell )

Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero indexed row and column number. Also returns two (0,1) values to indicate whether the row or column are relative references.

Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero indexed row and column number. Also returns two (0,1) values to indicate whether the row or column are relative references.

Parameters

$cell
The Excel cell reference in A1 format.

Returns

array
public
# _advance( )

Advance to the next valid token.

Advance to the next valid token.

public mixed
# _match( mixed $token )

Checks if it's a valid token.

Checks if it's a valid token.

Parameters

$token
The token to check.

Returns

mixed
The checked token or false on failure
public mixed
# parse( string $formula )

The parsing method. It parses a formula.

The parsing method. It parses a formula.

Parameters

$formula

The formula to parse, without the initial equal sign (=).

Returns

mixed
true on success
public mixed
# _condition( )

It parses a condition. It assumes the following rule: Cond -> Expr [(">" | "<") Expr]

It parses a condition. It assumes the following rule: Cond -> Expr [(">" | "<") Expr]

Returns

mixed
The parsed ptg'd tree on success
public mixed
# _expression( )

It parses a expression. It assumes the following rule: Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term : Negative value -> "+" Term : Positive value -> Error code

It parses a expression. It assumes the following rule: Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term : Negative value -> "+" Term : Positive value -> Error code

Returns

mixed
The parsed ptg'd tree on success
public array
# _parenthesizedExpression( )

This function just introduces a ptgParen element in the tree, so that Excel doesn't get confused when working with a parenthesized formula afterwards.

This function just introduces a ptgParen element in the tree, so that Excel doesn't get confused when working with a parenthesized formula afterwards.

Returns

array
The parsed ptg'd tree

See

PHPExcel_Writer_Excel5_Parser::_fact()
public mixed
# _term( )

It parses a term. It assumes the following rule: Term -> Fact [("*" | "/") Fact]

It parses a term. It assumes the following rule: Term -> Fact [("*" | "/") Fact]

Returns

mixed
The parsed ptg'd tree on success
public mixed
# _fact( )

It parses a factor. It assumes the following rule: Fact -> ( Expr ) | CellRef | CellRange | Number | Function

It parses a factor. It assumes the following rule: Fact -> ( Expr ) | CellRef | CellRange | Number | Function

Returns

mixed
The parsed ptg'd tree on success
public mixed
# _func( )

It parses a function call. It assumes the following rule: Func -> ( Expr [,Expr]* )

It parses a function call. It assumes the following rule: Func -> ( Expr [,Expr]* )

Returns

mixed
The parsed ptg'd tree on success
public array
# _createTree( mixed $value, mixed $left, mixed $right )

Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements.

Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements.

Parameters

$value
The value of this node.
$left
The left array (sub-tree) or a final node.
$right
The right array (sub-tree) or a final node.

Returns

array
A tree
public string
# toReversePolish( array $tree = array() )

Builds a string containing the tree in reverse polish notation (What you would use in a HP calculator stack). The following tree:

Builds a string containing the tree in reverse polish notation (What you would use in a HP calculator stack). The following tree:

  • / \ 2 3

produces: "23+"

The following tree: + / \ 3 * / \ 6 A1

produces: "36A1*+"

In fact all operands, functions, references, etc... are written as ptg's

Parameters

$tree
The optional tree to convert.

Returns

string
The tree in reverse polish notation
Constants summary
string REGEX_SHEET_TITLE_UNQUOTED
# '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&\<\>\=\,\;\#\(\)\"\{\}]+'
string REGEX_SHEET_TITLE_QUOTED
# '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+'
Properties summary
public integer $_current_char

The index of the character we are currently looking at

The index of the character we are currently looking at

#
public string $_current_token

The token we are working on.

The token we are working on.

#
public string $_formula

The formula to parse

The formula to parse

#
public string $_lookahead

The character ahead of the current char

The character ahead of the current char

#
public string $_parse_tree

The parse tree to be generated

The parse tree to be generated

#
public array $_ext_sheets

Array of external sheets

Array of external sheets

#
public array $_references

Array of sheet references in the form of REF structures

Array of sheet references in the form of REF structures

#
Autene API documentation generated by ApiGen