\PHPExcel_Style_NumberFormat

PHPExcel_Style_NumberFormat

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
__construct()
bindParent()
getIsSupervisor()
getActiveSheet()
getSelectedCells()
getActiveCell()
__clone()
getSharedComponent()
getStyleArray()
applyFromArray()
getFormatCode()
setFormatCode()
getBuiltInFormatCode()
setBuiltInFormatCode()
builtInFormatCode()
builtInFormatCodeIndex()
getHashCode()
toFormattedString()
No public properties found
FORMAT_GENERAL
FORMAT_TEXT
FORMAT_NUMBER
FORMAT_NUMBER_00
FORMAT_NUMBER_COMMA_SEPARATED1
FORMAT_NUMBER_COMMA_SEPARATED2
FORMAT_PERCENTAGE
FORMAT_PERCENTAGE_00
FORMAT_DATE_YYYYMMDD2
FORMAT_DATE_YYYYMMDD
FORMAT_DATE_DDMMYYYY
FORMAT_DATE_DMYSLASH
FORMAT_DATE_DMYMINUS
FORMAT_DATE_DMMINUS
FORMAT_DATE_MYMINUS
FORMAT_DATE_XLSX14
FORMAT_DATE_XLSX15
FORMAT_DATE_XLSX16
FORMAT_DATE_XLSX17
FORMAT_DATE_XLSX22
FORMAT_DATE_DATETIME
FORMAT_DATE_TIME1
FORMAT_DATE_TIME2
FORMAT_DATE_TIME3
FORMAT_DATE_TIME4
FORMAT_DATE_TIME5
FORMAT_DATE_TIME6
FORMAT_DATE_TIME7
FORMAT_DATE_TIME8
FORMAT_DATE_YYYYMMDDSLASH
FORMAT_CURRENCY_USD_SIMPLE
FORMAT_CURRENCY_USD
FORMAT_CURRENCY_EUR_SIMPLE
No protected methods found
$isSupervisor
$parent
$builtInFormats
$flippedBuiltInFormats
$formatCode
$builtInFormatCode
N/A
fillBuiltInFormatCodes()
setLowercaseCallback()
escapeQuotesCallback()
formatAsDate()
formatAsPercentage()
formatAsFraction()
complexNumberFormatMask()
$dateFormatReplacements
$dateFormatReplacements24
$dateFormatReplacements12
N/A

Constants

FORMAT_GENERAL

FORMAT_GENERAL = 'General'

FORMAT_TEXT

FORMAT_TEXT = '@'

FORMAT_NUMBER

FORMAT_NUMBER = '0'

FORMAT_NUMBER_00

FORMAT_NUMBER_00 = '0.00'

FORMAT_NUMBER_COMMA_SEPARATED1

FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'

FORMAT_NUMBER_COMMA_SEPARATED2

FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'

FORMAT_PERCENTAGE

FORMAT_PERCENTAGE = '0%'

FORMAT_PERCENTAGE_00

FORMAT_PERCENTAGE_00 = '0.00%'

FORMAT_DATE_YYYYMMDD2

FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'

FORMAT_DATE_YYYYMMDD

FORMAT_DATE_YYYYMMDD = 'yy-mm-dd'

FORMAT_DATE_DDMMYYYY

FORMAT_DATE_DDMMYYYY = 'dd/mm/yy'

FORMAT_DATE_DMYSLASH

FORMAT_DATE_DMYSLASH = 'd/m/y'

FORMAT_DATE_DMYMINUS

FORMAT_DATE_DMYMINUS = 'd-m-y'

FORMAT_DATE_DMMINUS

FORMAT_DATE_DMMINUS = 'd-m'

FORMAT_DATE_MYMINUS

FORMAT_DATE_MYMINUS = 'm-y'

FORMAT_DATE_XLSX14

FORMAT_DATE_XLSX14 = 'mm-dd-yy'

FORMAT_DATE_XLSX15

FORMAT_DATE_XLSX15 = 'd-mmm-yy'

FORMAT_DATE_XLSX16

FORMAT_DATE_XLSX16 = 'd-mmm'

FORMAT_DATE_XLSX17

FORMAT_DATE_XLSX17 = 'mmm-yy'

FORMAT_DATE_XLSX22

FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'

FORMAT_DATE_DATETIME

FORMAT_DATE_DATETIME = 'd/m/y h:mm'

FORMAT_DATE_TIME1

FORMAT_DATE_TIME1 = 'h:mm AM/PM'

FORMAT_DATE_TIME2

FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'

FORMAT_DATE_TIME3

FORMAT_DATE_TIME3 = 'h:mm'

FORMAT_DATE_TIME4

FORMAT_DATE_TIME4 = 'h:mm:ss'

FORMAT_DATE_TIME5

FORMAT_DATE_TIME5 = 'mm:ss'

FORMAT_DATE_TIME6

FORMAT_DATE_TIME6 = 'h:mm:ss'

FORMAT_DATE_TIME7

FORMAT_DATE_TIME7 = 'i:s.S'

FORMAT_DATE_TIME8

FORMAT_DATE_TIME8 = 'h:mm:ss;@'

FORMAT_DATE_YYYYMMDDSLASH

FORMAT_DATE_YYYYMMDDSLASH = 'yy/mm/dd;@'

FORMAT_CURRENCY_USD_SIMPLE

FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'

FORMAT_CURRENCY_USD

FORMAT_CURRENCY_USD = '$#,##0_-'

FORMAT_CURRENCY_EUR_SIMPLE

FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-'

Properties

$isSupervisor

$isSupervisor : boolean

Supervisor?

Type

boolean

$parent

$parent : \PHPExcel_Style

Parent. Only used for supervisor

Type

\PHPExcel_Style

$builtInFormats

$builtInFormats : array

Excel built-in number formats

Type

array

$flippedBuiltInFormats

$flippedBuiltInFormats : array

Excel built-in number formats (flipped, for faster lookups)

Type

array

$formatCode

$formatCode : string

Format Code

Type

string

$builtInFormatCode

$builtInFormatCode : string

Built-in format Code

Type

string

$dateFormatReplacements

$dateFormatReplacements : array

Search/replace values to convert Excel date/time format masks to PHP format masks

Type

array

$dateFormatReplacements24

$dateFormatReplacements24 : array

Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock)

Type

array

$dateFormatReplacements12

$dateFormatReplacements12 : array

Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock)

Type

array

Methods

__construct()

__construct(boolean  $isSupervisor = false, boolean  $isConditional = false) 

Create a new PHPExcel_Style_NumberFormat

Parameters

boolean $isSupervisor

Flag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are

boolean $isConditional

Flag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

bindParent()

bindParent(\PHPExcel  $parent,   $parentPropertyName = null) : \PHPExcel_Style_Supervisor

Bind parent. Only used for supervisor

Parameters

\PHPExcel $parent
$parentPropertyName

Returns

\PHPExcel_Style_Supervisor

getIsSupervisor()

getIsSupervisor() : boolean

Is this a supervisor or a cell style component?

Returns

boolean

getActiveSheet()

getActiveSheet() : \PHPExcel_Worksheet

Get the currently active sheet. Only used for supervisor

Returns

\PHPExcel_Worksheet

getSelectedCells()

getSelectedCells() : string

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns

string —

E.g. 'A1'

getActiveCell()

getActiveCell() : string

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns

string —

E.g. 'A1'

__clone()

__clone() 

Implement PHP __clone to create a deep clone, not just a shallow copy.

getSharedComponent()

getSharedComponent() : \PHPExcel_Style_NumberFormat

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Returns

\PHPExcel_Style_NumberFormat

getStyleArray()

getStyleArray(array  $array) : array

Build style array from subcomponents

Parameters

array $array

Returns

array

applyFromArray()

applyFromArray(array  $pStyles = null) : \PHPExcel_Style_NumberFormat

Apply styles from array

$objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( array( 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE ) );

Parameters

array $pStyles

Array containing style information

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style_NumberFormat

getFormatCode()

getFormatCode() : string

Get Format Code

Returns

string

setFormatCode()

setFormatCode(string  $pValue = \PHPExcel_Style_NumberFormat::FORMAT_GENERAL) : \PHPExcel_Style_NumberFormat

Set Format Code

Parameters

string $pValue

Returns

\PHPExcel_Style_NumberFormat

getBuiltInFormatCode()

getBuiltInFormatCode() : integer

Get Built-In Format Code

Returns

integer

setBuiltInFormatCode()

setBuiltInFormatCode(integer  $pValue) : \PHPExcel_Style_NumberFormat

Set Built-In Format Code

Parameters

integer $pValue

Returns

\PHPExcel_Style_NumberFormat

builtInFormatCode()

builtInFormatCode(integer  $pIndex) : string

Get built-in format code

Parameters

integer $pIndex

Returns

string

builtInFormatCodeIndex()

builtInFormatCodeIndex(string  $formatCode) : integer|boolean

Get built-in format code index

Parameters

string $formatCode

Returns

integer|boolean

getHashCode()

getHashCode() : string

Get hash code

Returns

string —

Hash code

toFormattedString()

toFormattedString(mixed  $value = '0', string  $format = \PHPExcel_Style_NumberFormat::FORMAT_GENERAL, array  $callBack = null) : string

Convert a value in a pre-defined format to a PHP string

Parameters

mixed $value

Value to format

string $format

Format code

array $callBack

Callback function for additional formatting of string

Returns

string —

Formatted string

fillBuiltInFormatCodes()

fillBuiltInFormatCodes() 

Fill built-in format codes

setLowercaseCallback()

setLowercaseCallback(  $matches) 

Parameters

$matches

escapeQuotesCallback()

escapeQuotesCallback(  $matches) 

Parameters

$matches

formatAsDate()

formatAsDate(  $value,   $format) 

Parameters

$value
$format

formatAsPercentage()

formatAsPercentage(  $value,   $format) 

Parameters

$value
$format

formatAsFraction()

formatAsFraction(  $value,   $format) 

Parameters

$value
$format

complexNumberFormatMask()

complexNumberFormatMask(  $number,   $mask,   $level) 

Parameters

$number
$mask
$level