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

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

Parameters

$number
$mask