[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/includes/php_writeexcel/ -> class.writeexcel_formula.inc.php (sommaire)

(pas de description)

Poids: 1413 lignes (57 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

writeexcel_formula:: (31 méthodes):
  writeexcel_formula()
  _init_parser()
  parse_formula()
  set_ext_sheet()
  isError()
  _initializeHashes()
  _convert()
  _convertNumber()
  _convertString()
  _convertFunction()
  _convertRange2d()
  _convertRange3d()
  _convertRef2d()
  _convertRef3d()
  _packExtRef()
  _getSheetIndex()
  setExtSheet()
  _cellToPackedRowcol()
  _rangeToPackedRange()
  _cellToRowcol()
  _advance()
  _match()
  parse()
  _condition()
  _expression()
  _parenthesizedExpression()
  _term()
  _fact()
  _func()
  _createTree()
  toReversePolish()


Classe: writeexcel_formula  - X-Ref

writeexcel_formula($byte_order)   X-Ref
Pas de description

_init_parser()   X-Ref
Pas de description

parse_formula()   X-Ref
Pas de description

set_ext_sheet($key, $value)   X-Ref
Pas de description

isError($data)   X-Ref
Pas de description

_initializeHashes()   X-Ref
Initialize the ptg and function hashes.


_convert($token)   X-Ref
Convert a token to the proper ptg value.

param: mixed $token The token to convert.
return: mixed the converted token on success. PEAR_Error if the token

_convertNumber($num)   X-Ref
Convert a number token to ptgInt or ptgNum

param: mixed $num an integer or double for conversion to its ptg value

_convertString($string)   X-Ref
Convert a string token to ptgStr

param: string $string A string for conversion to its ptg value

_convertFunction($token, $num_args)   X-Ref
Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
args that it takes.

param: string  $token    The name of the function for convertion to ptg value.
param: integer $num_args The number of arguments the function receives.
return: string The packed ptg for the function

_convertRange2d($range)   X-Ref
Convert an Excel range such as A1:D4 to a ptgRefV.

param: string $range An Excel range in the A1:A2 or A1..A2 format.

_convertRange3d($token)   X-Ref
Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
a ptgArea3dV.

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

_convertRef2d($cell)   X-Ref
Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.

param: string $cell An Excel cell reference
return: string The cell in packed() format with the corresponding ptg

_convertRef3d($cell)   X-Ref
Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
ptgRef3dV.

param: string $cell An Excel cell reference
return: string The cell in packed() format with the corresponding ptg

_packExtRef($ext_ref)   X-Ref
Convert the sheet name part of an external reference, for example "Sheet1" or
"Sheet1:Sheet2", to a packed structure.

param: string $ext_ref The name of the external reference
return: string The reference index in packed() format

_getSheetIndex($sheet_name)   X-Ref
Look up the index that corresponds to an external sheet name. The hash of
sheet names is updated by the addworksheet() method of the
Spreadsheet_Excel_Writer_Workbook class.

return: integer

setExtSheet($name, $index)   X-Ref
This method is used to update the array of sheet names. It is
called by the addWorksheet() method of the Spreadsheet_Excel_Writer_Workbook class.

param: string  $name  The name of the worksheet being added
param: integer $index The index of the worksheet being added

_cellToPackedRowcol($cell)   X-Ref
pack() row and column into the required 3 byte format.

param: string $cell The Excel cell reference to be packed
return: array Array containing the row and column in packed() format

_rangeToPackedRange($range)   X-Ref
pack() row range into the required 3 byte format.
Just using maximun col/rows, which is probably not the correct solution

param: string $range The Excel range to be packed
return: array Array containing (row1,col1,row2,col2) in packed() format

_cellToRowcol($cell)   X-Ref
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.

param: string $cell The Excel cell reference in A1 format.
return: array

_advance()   X-Ref
Advance to the next valid token.


_match($token)   X-Ref
Checks if it's a valid token.

param: mixed $token The token to check.
return: mixed       The checked token or false on failure

parse($formula)   X-Ref
The parsing method. It parses a formula.

param: string $formula The formula to parse, without the initial equal sign (=).

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

return: mixed The parsed ptg'd tree

_expression()   X-Ref
It parses a expression. It assumes the following rule:
Expr -> Term [("+" | "-") Term]

return: mixed The parsed ptg'd tree

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

return: mixed The parsed ptg'd tree

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

return: mixed The parsed ptg'd tree

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

return: mixed The parsed ptg'd tree

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


_createTree($value, $left, $right)   X-Ref
Creates a tree. In fact an array which may have one or two arrays (sub-trees)
as elements.

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

toReversePolish($tree = array()   X-Ref
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

param: array $tree The optional tree to convert.
return: string The tree in reverse polish notation



Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics