class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable

PHPExcelStyleNumberFormat

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

Constants

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

Methods

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

Create a new PHPExcelStyleNumberFormat

bindParent($parent, $parentPropertyName = null)

Bind parent. Only used for supervisor

boolean
getIsSupervisor()

Is this a supervisor or a cell style component?

getActiveSheet()

Get the currently active sheet. Only used for supervisor

string
getSelectedCells()

Get the currently active cell coordinate in currently active sheet.

string
getActiveCell()

Get the currently active cell coordinate in currently active sheet.

__clone()

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

getSharedComponent()

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

array
getStyleArray(array $array)

Build style array from subcomponents

applyFromArray(array $pStyles = null)

Apply styles from array

string
getFormatCode()

Get Format Code

setFormatCode(string $pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL)

Set Format Code

int
getBuiltInFormatCode()

Get Built-In Format Code

setBuiltInFormatCode(int $pValue)

Set Built-In Format Code

static string
builtInFormatCode(int $pIndex)

Get built-in format code

static int|boolean
builtInFormatCodeIndex(string $formatCode)

Get built-in format code index

string
getHashCode()

Get hash code

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

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

Details

at line 117
__construct(boolean $isSupervisor = false, boolean $isConditional = false)

Create a new PHPExcelStyleNumberFormat

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

PHPExcel_Style_Supervisor bindParent($parent, $parentPropertyName = null)

Bind parent. Only used for supervisor

Parameters

$parent
$parentPropertyName

Return Value

PHPExcel_Style_Supervisor

boolean getIsSupervisor()

Is this a supervisor or a cell style component?

Return Value

boolean

PHPExcel_Worksheet getActiveSheet()

Get the currently active sheet. Only used for supervisor

Return Value

PHPExcel_Worksheet

string getSelectedCells()

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Return Value

string E.g. 'A1'

string getActiveCell()

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Return Value

string E.g. 'A1'

__clone()

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

at line 134
PHPExcel_Style_NumberFormat getSharedComponent()

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

Only used for style supervisor

at line 145
array getStyleArray(array $array)

Build style array from subcomponents

Parameters

array $array

Return Value

array

at line 165
PHPExcel_Style_NumberFormat applyFromArray(array $pStyles = null)

Apply styles from array

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

Parameters

array $pStyles Array containing style information

Return Value

PHPExcel_Style_NumberFormat

Exceptions

PHPExcel_Exception

at line 186
string getFormatCode()

Get Format Code

Return Value

string

at line 203
PHPExcel_Style_NumberFormat setFormatCode(string $pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL)

Set Format Code

Parameters

string $pValue

Return Value

PHPExcel_Style_NumberFormat

at line 223
int getBuiltInFormatCode()

Get Built-In Format Code

Return Value

int

at line 237
PHPExcel_Style_NumberFormat setBuiltInFormatCode(int $pValue)

Set Built-In Format Code

Parameters

int $pValue

Return Value

PHPExcel_Style_NumberFormat

at line 343
static string builtInFormatCode(int $pIndex)

Get built-in format code

Parameters

int $pIndex

Return Value

string

at line 364
static int|boolean builtInFormatCodeIndex(string $formatCode)

Get built-in format code index

Parameters

string $formatCode

Return Value

int|boolean

at line 382
string getHashCode()

Get hash code

Return Value

string Hash code

at line 588
static string toFormattedString(mixed $value = '0', string $format = PHPExcel_Style_NumberFormat::FORMAT_GENERAL, array $callBack = null)

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

Return Value

string Formatted string