ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Style\NumberFormat Class Reference
+ Inheritance diagram for PhpOffice\PhpSpreadsheet\Style\NumberFormat:
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Style\NumberFormat:

Public Member Functions

 __construct ($isSupervisor=false, $isConditional=false)
 Create a new NumberFormat. More...
 
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet. More...
 
 getStyleArray ($array)
 Build style array from subcomponents. More...
 
 applyFromArray (array $pStyles)
 Apply styles from array. More...
 
 getFormatCode ()
 Get Format Code. More...
 
 setFormatCode ($pValue)
 Set Format Code. More...
 
 getBuiltInFormatCode ()
 Get Built-In Format Code. More...
 
 setBuiltInFormatCode ($pValue)
 Set Built-In Format Code. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 __construct ($isSupervisor=false)
 Create a new Supervisor. More...
 
 bindParent ($parent, $parentPropertyName=null)
 Bind parent. More...
 
 getIsSupervisor ()
 Is this a supervisor or a cell style component? More...
 
 getActiveSheet ()
 Get the currently active sheet. More...
 
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 getActiveCell ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 
 exportArray ()
 Export style as array. More...
 

Static Public Member Functions

static builtInFormatCode ($pIndex)
 Get built-in format code. More...
 
static builtInFormatCodeIndex ($formatCode)
 Get built-in format code index. More...
 
static toFormattedString ($value, $format, $callBack=null)
 Convert a value in a pre-defined format to a PHP string. More...
 

Data Fields

const FORMAT_GENERAL = 'General'
 
const FORMAT_TEXT = '@'
 
const FORMAT_NUMBER = '0'
 
const FORMAT_NUMBER_00 = '0.00'
 
const FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'
 
const FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'
 
const FORMAT_PERCENTAGE = '0%'
 
const FORMAT_PERCENTAGE_00 = '0.00%'
 
const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'
 
const FORMAT_DATE_YYYYMMDD = 'yyyy-mm-dd'
 
const FORMAT_DATE_DDMMYYYY = 'dd/mm/yyyy'
 
const FORMAT_DATE_DMYSLASH = 'd/m/yy'
 
const FORMAT_DATE_DMYMINUS = 'd-m-yy'
 
const FORMAT_DATE_DMMINUS = 'd-m'
 
const FORMAT_DATE_MYMINUS = 'm-yy'
 
const FORMAT_DATE_XLSX14 = 'mm-dd-yy'
 
const FORMAT_DATE_XLSX15 = 'd-mmm-yy'
 
const FORMAT_DATE_XLSX16 = 'd-mmm'
 
const FORMAT_DATE_XLSX17 = 'mmm-yy'
 
const FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'
 
const FORMAT_DATE_DATETIME = 'd/m/yy h:mm'
 
const FORMAT_DATE_TIME1 = 'h:mm AM/PM'
 
const FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'
 
const FORMAT_DATE_TIME3 = 'h:mm'
 
const FORMAT_DATE_TIME4 = 'h:mm:ss'
 
const FORMAT_DATE_TIME5 = 'mm:ss'
 
const FORMAT_DATE_TIME6 = 'h:mm:ss'
 
const FORMAT_DATE_TIME7 = 'i:s.S'
 
const FORMAT_DATE_TIME8 = 'h:mm:ss;@'
 
const FORMAT_DATE_YYYYMMDDSLASH = 'yyyy/mm/dd;@'
 
const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'
 
const FORMAT_CURRENCY_USD = '$#,##0_-'
 
const FORMAT_CURRENCY_EUR_SIMPLE = '#,##0.00_-"€"'
 
const FORMAT_CURRENCY_EUR = '#,##0_-"€"'
 
const FORMAT_ACCOUNTING_USD = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'
 
const FORMAT_ACCOUNTING_EUR = '_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)'
 

Protected Member Functions

 exportArray1 ()
 
- Protected Member Functions inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 exportArray1 ()
 Abstract method to be implemented in anything which extends this class. More...
 
 exportArray2 (array &$exportedArray, string $index, $objOrValue)
 Populate array from exportArray1. More...
 

Protected Attributes

 $formatCode = self::FORMAT_GENERAL
 
 $builtInFormatCode = 0
 
- Protected Attributes inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 $isSupervisor
 
 $parent
 
 $parentPropertyName
 

Static Protected Attributes

static $builtInFormats
 
static $flippedBuiltInFormats
 

Static Private Member Functions

static fillBuiltInFormatCodes ()
 Fill built-in format codes. More...
 

Detailed Description

Definition at line 5 of file NumberFormat.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::__construct (   $isSupervisor = false,
  $isConditional = false 
)

Create a new NumberFormat.

Parameters
bool$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
bool$isConditionalFlag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

Definition at line 88 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\$isSupervisor, and PhpOffice\PhpSpreadsheet\Style\NumberFormat\builtInFormatCode().

89  {
90  // Supervisor?
91  parent::__construct($isSupervisor);
92 
93  if ($isConditional) {
94  $this->formatCode = null;
95  $this->builtInFormatCode = false;
96  }
97  }
static builtInFormatCode($pIndex)
Get built-in format code.
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFromArray()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::applyFromArray ( array  $pStyles)

Apply styles from array.

$spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( [ 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE ] );

Parameters
array$pStylesArray containing style information
Returns
$this

Definition at line 137 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), PhpOffice\PhpSpreadsheet\Style\NumberFormat\getStyleArray(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\setFormatCode().

138  {
139  if ($this->isSupervisor) {
140  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
141  } else {
142  if (isset($pStyles['formatCode'])) {
143  $this->setFormatCode($pStyles['formatCode']);
144  }
145  }
146 
147  return $this;
148  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:

◆ builtInFormatCode()

static PhpOffice\PhpSpreadsheet\Style\NumberFormat::builtInFormatCode (   $pIndex)
static

Get built-in format code.

Parameters
int$pIndex
Returns
string

Definition at line 334 of file NumberFormat.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\NumberFormat\__construct(), PhpOffice\PhpSpreadsheet\Style\NumberFormat\getFormatCode(), PhpOffice\PhpSpreadsheet\Reader\Xlsx\getFromZipArchive(), PhpOffice\PhpSpreadsheet\Style\NumberFormat\getHashCode(), PhpOffice\PhpSpreadsheet\Reader\Xls\readXf(), PhpOffice\PhpSpreadsheet\Style\NumberFormat\setBuiltInFormatCode(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\setFormatCode().

335  {
336  // Clean parameter
337  $pIndex = (int) $pIndex;
338 
339  // Ensure built-in format codes are available
340  self::fillBuiltInFormatCodes();
341 
342  // Lookup format code
343  if (isset(self::$builtInFormats[$pIndex])) {
344  return self::$builtInFormats[$pIndex];
345  }
346 
347  return '';
348  }
+ Here is the caller graph for this function:

◆ builtInFormatCodeIndex()

static PhpOffice\PhpSpreadsheet\Style\NumberFormat::builtInFormatCodeIndex (   $formatCode)
static

Get built-in format code index.

Parameters
string$formatCode
Returns
bool|int

Definition at line 357 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\NumberFormat\$formatCode.

358  {
359  // Ensure built-in format codes are available
360  self::fillBuiltInFormatCodes();
361 
362  // Lookup format code
363  if (array_key_exists($formatCode, self::$flippedBuiltInFormats)) {
364  return self::$flippedBuiltInFormats[$formatCode];
365  }
366 
367  return false;
368  }

◆ exportArray1()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::exportArray1 ( )
protected

Definition at line 402 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\exportArray2(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getFormatCode().

402  : array
403  {
404  $exportedArray = [];
405  $this->exportArray2($exportedArray, 'formatCode', $this->getFormatCode());
406 
407  return $exportedArray;
408  }
exportArray2(array &$exportedArray, string $index, $objOrValue)
Populate array from exportArray1.
Definition: Supervisor.php:150
+ Here is the call graph for this function:

◆ fillBuiltInFormatCodes()

static PhpOffice\PhpSpreadsheet\Style\NumberFormat::fillBuiltInFormatCodes ( )
staticprivate

Fill built-in format codes.

Definition at line 227 of file NumberFormat.php.

227  : void
228  {
229  // [MS-OI29500: Microsoft Office Implementation Information for ISO/IEC-29500 Standard Compliance]
230  // 18.8.30. numFmt (Number Format)
231  //
232  // The ECMA standard defines built-in format IDs
233  // 14: "mm-dd-yy"
234  // 22: "m/d/yy h:mm"
235  // 37: "#,##0 ;(#,##0)"
236  // 38: "#,##0 ;[Red](#,##0)"
237  // 39: "#,##0.00;(#,##0.00)"
238  // 40: "#,##0.00;[Red](#,##0.00)"
239  // 47: "mmss.0"
240  // KOR fmt 55: "yyyy-mm-dd"
241  // Excel defines built-in format IDs
242  // 14: "m/d/yyyy"
243  // 22: "m/d/yyyy h:mm"
244  // 37: "#,##0_);(#,##0)"
245  // 38: "#,##0_);[Red](#,##0)"
246  // 39: "#,##0.00_);(#,##0.00)"
247  // 40: "#,##0.00_);[Red](#,##0.00)"
248  // 47: "mm:ss.0"
249  // KOR fmt 55: "yyyy/mm/dd"
250 
251  // Built-in format codes
252  if (self::$builtInFormats === null) {
253  self::$builtInFormats = [];
254 
255  // General
256  self::$builtInFormats[0] = self::FORMAT_GENERAL;
257  self::$builtInFormats[1] = '0';
258  self::$builtInFormats[2] = '0.00';
259  self::$builtInFormats[3] = '#,##0';
260  self::$builtInFormats[4] = '#,##0.00';
261 
262  self::$builtInFormats[9] = '0%';
263  self::$builtInFormats[10] = '0.00%';
264  self::$builtInFormats[11] = '0.00E+00';
265  self::$builtInFormats[12] = '# ?/?';
266  self::$builtInFormats[13] = '# ??/??';
267  self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy';
268  self::$builtInFormats[15] = 'd-mmm-yy';
269  self::$builtInFormats[16] = 'd-mmm';
270  self::$builtInFormats[17] = 'mmm-yy';
271  self::$builtInFormats[18] = 'h:mm AM/PM';
272  self::$builtInFormats[19] = 'h:mm:ss AM/PM';
273  self::$builtInFormats[20] = 'h:mm';
274  self::$builtInFormats[21] = 'h:mm:ss';
275  self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm';
276 
277  self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)';
278  self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)';
279  self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)';
280  self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)';
281 
282  self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
283  self::$builtInFormats[45] = 'mm:ss';
284  self::$builtInFormats[46] = '[h]:mm:ss';
285  self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0';
286  self::$builtInFormats[48] = '##0.0E+0';
287  self::$builtInFormats[49] = '@';
288 
289  // CHT
290  self::$builtInFormats[27] = '[$-404]e/m/d';
291  self::$builtInFormats[30] = 'm/d/yy';
292  self::$builtInFormats[36] = '[$-404]e/m/d';
293  self::$builtInFormats[50] = '[$-404]e/m/d';
294  self::$builtInFormats[57] = '[$-404]e/m/d';
295 
296  // THA
297  self::$builtInFormats[59] = 't0';
298  self::$builtInFormats[60] = 't0.00';
299  self::$builtInFormats[61] = 't#,##0';
300  self::$builtInFormats[62] = 't#,##0.00';
301  self::$builtInFormats[67] = 't0%';
302  self::$builtInFormats[68] = 't0.00%';
303  self::$builtInFormats[69] = 't# ?/?';
304  self::$builtInFormats[70] = 't# ??/??';
305 
306  // JPN
307  self::$builtInFormats[28] = '[$-411]ggge"年"m"月"d"日"';
308  self::$builtInFormats[29] = '[$-411]ggge"年"m"月"d"日"';
309  self::$builtInFormats[31] = 'yyyy"年"m"月"d"日"';
310  self::$builtInFormats[32] = 'h"時"mm"分"';
311  self::$builtInFormats[33] = 'h"時"mm"分"ss"秒"';
312  self::$builtInFormats[34] = 'yyyy"年"m"月"';
313  self::$builtInFormats[35] = 'm"月"d"日"';
314  self::$builtInFormats[51] = '[$-411]ggge"年"m"月"d"日"';
315  self::$builtInFormats[52] = 'yyyy"年"m"月"';
316  self::$builtInFormats[53] = 'm"月"d"日"';
317  self::$builtInFormats[54] = '[$-411]ggge"年"m"月"d"日"';
318  self::$builtInFormats[55] = 'yyyy"年"m"月"';
319  self::$builtInFormats[56] = 'm"月"d"日"';
320  self::$builtInFormats[58] = '[$-411]ggge"年"m"月"d"日"';
321 
322  // Flip array (for faster lookups)
323  self::$flippedBuiltInFormats = array_flip(self::$builtInFormats);
324  }
325  }

◆ getBuiltInFormatCode()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::getBuiltInFormatCode ( )

Get Built-In Format Code.

Returns
false|int

Definition at line 195 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\NumberFormat\$builtInFormatCode, and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getSharedComponent().

196  {
197  if ($this->isSupervisor) {
198  return $this->getSharedComponent()->getBuiltInFormatCode();
199  }
200 
202  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
+ Here is the call graph for this function:

◆ getFormatCode()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::getFormatCode ( )

Get Format Code.

Returns
null|string

Definition at line 155 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\NumberFormat\$formatCode, PhpOffice\PhpSpreadsheet\Style\NumberFormat\builtInFormatCode(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\NumberFormat\exportArray1(), PhpOffice\PhpSpreadsheet\Shared\Date\isDateTimeFormat(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeNumFmt().

156  {
157  if ($this->isSupervisor) {
158  return $this->getSharedComponent()->getFormatCode();
159  }
160  if ($this->builtInFormatCode !== false) {
161  return self::builtInFormatCode($this->builtInFormatCode);
162  }
163 
164  return $this->formatCode;
165  }
static builtInFormatCode($pIndex)
Get built-in format code.
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHashCode()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

Definition at line 375 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\NumberFormat\builtInFormatCode(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getSharedComponent().

376  {
377  if ($this->isSupervisor) {
378  return $this->getSharedComponent()->getHashCode();
379  }
380 
381  return md5(
382  $this->formatCode .
383  $this->builtInFormatCode .
384  __CLASS__
385  );
386  }
static builtInFormatCode($pIndex)
Get built-in format code.
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
+ Here is the call graph for this function:

◆ getSharedComponent()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::getSharedComponent ( )

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

Only used for style supervisor.

Returns
NumberFormat

Definition at line 105 of file NumberFormat.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\NumberFormat\getBuiltInFormatCode(), PhpOffice\PhpSpreadsheet\Style\NumberFormat\getFormatCode(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getHashCode().

106  {
107  return $this->parent->getSharedComponent()->getNumberFormat();
108  }
+ Here is the caller graph for this function:

◆ getStyleArray()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 117 of file NumberFormat.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\NumberFormat\applyFromArray(), PhpOffice\PhpSpreadsheet\Style\NumberFormat\setBuiltInFormatCode(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\setFormatCode().

118  {
119  return ['numberFormat' => $array];
120  }
+ Here is the caller graph for this function:

◆ setBuiltInFormatCode()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::setBuiltInFormatCode (   $pValue)

Set Built-In Format Code.

Parameters
int$pValue
Returns
$this

Definition at line 211 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\NumberFormat\builtInFormatCode(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getStyleArray().

212  {
213  if ($this->isSupervisor) {
214  $styleArray = $this->getStyleArray(['formatCode' => self::builtInFormatCode($pValue)]);
215  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
216  } else {
217  $this->builtInFormatCode = $pValue;
218  $this->formatCode = self::builtInFormatCode($pValue);
219  }
220 
221  return $this;
222  }
static builtInFormatCode($pIndex)
Get built-in format code.
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:

◆ setFormatCode()

PhpOffice\PhpSpreadsheet\Style\NumberFormat::setFormatCode (   $pValue)

Set Format Code.

Parameters
string$pValuesee self::FORMAT_*
Returns
$this

Definition at line 174 of file NumberFormat.php.

References PhpOffice\PhpSpreadsheet\Style\NumberFormat\builtInFormatCode(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\NumberFormat\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\NumberFormat\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readNumberFormat().

175  {
176  if ($pValue == '') {
177  $pValue = self::FORMAT_GENERAL;
178  }
179  if ($this->isSupervisor) {
180  $styleArray = $this->getStyleArray(['formatCode' => $pValue]);
181  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
182  } else {
183  $this->formatCode = $pValue;
184  $this->builtInFormatCode = self::builtInFormatCodeIndex($pValue);
185  }
186 
187  return $this;
188  }
static builtInFormatCode($pIndex)
Get built-in format code.
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toFormattedString()

static PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString (   $value,
  $format,
  $callBack = null 
)
static

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

Parameters
mixed$valueValue to format
string$formatFormat code, see = self::FORMAT_*
array$callBackCallback function for additional formatting of string
Returns
string Formatted string

Definition at line 397 of file NumberFormat.php.

References $format, and PhpOffice\PhpSpreadsheet\Style\NumberFormat\Formatter\toFormattedString().

Referenced by PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\calculateColumnWidths(), PhpOffice\PhpSpreadsheet\Calculation\TextData\Format\DOLLAR(), PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph\formatDataSetLabels(), PhpOffice\PhpSpreadsheet\Writer\Html\generateRowCellDataValue(), PhpOffice\PhpSpreadsheet\Cell\Cell\getFormattedValue(), PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\rangeToArray(), and PhpOffice\PhpSpreadsheet\Calculation\TextData\Format\TEXTFORMAT().

398  {
399  return NumberFormat\Formatter::toFormattedString($value, $format, $callBack);
400  }
$format
Definition: metadata.php:141
static toFormattedString($value, $format, $callBack=null)
Convert a value in a pre-defined format to a PHP string.
Definition: Formatter.php:102
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $builtInFormatCode

PhpOffice\PhpSpreadsheet\Style\NumberFormat::$builtInFormatCode = 0
protected

◆ $builtInFormats

PhpOffice\PhpSpreadsheet\Style\NumberFormat::$builtInFormats
staticprotected

Definition at line 55 of file NumberFormat.php.

◆ $flippedBuiltInFormats

PhpOffice\PhpSpreadsheet\Style\NumberFormat::$flippedBuiltInFormats
staticprotected

Definition at line 62 of file NumberFormat.php.

◆ $formatCode

PhpOffice\PhpSpreadsheet\Style\NumberFormat::$formatCode = self::FORMAT_GENERAL
protected

◆ FORMAT_ACCOUNTING_EUR

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR = '_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)'

Definition at line 48 of file NumberFormat.php.

◆ FORMAT_ACCOUNTING_USD

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_USD = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'

Definition at line 47 of file NumberFormat.php.

◆ FORMAT_CURRENCY_EUR

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR = '#,##0_-"€"'

Definition at line 46 of file NumberFormat.php.

◆ FORMAT_CURRENCY_EUR_SIMPLE

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE = '#,##0.00_-"€"'

Definition at line 45 of file NumberFormat.php.

◆ FORMAT_CURRENCY_USD

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD = '$#,##0_-'

Definition at line 44 of file NumberFormat.php.

◆ FORMAT_CURRENCY_USD_SIMPLE

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'

◆ FORMAT_DATE_DATETIME

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME = 'd/m/yy h:mm'

◆ FORMAT_DATE_DDMMYYYY

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY = 'dd/mm/yyyy'

◆ FORMAT_DATE_DMMINUS

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DMMINUS = 'd-m'

◆ FORMAT_DATE_DMYMINUS

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DMYMINUS = 'd-m-yy'

◆ FORMAT_DATE_DMYSLASH

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DMYSLASH = 'd/m/yy'

◆ FORMAT_DATE_MYMINUS

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_MYMINUS = 'm-yy'

◆ FORMAT_DATE_TIME1

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME1 = 'h:mm AM/PM'

◆ FORMAT_DATE_TIME2

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'

◆ FORMAT_DATE_TIME3

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME3 = 'h:mm'

◆ FORMAT_DATE_TIME4

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4 = 'h:mm:ss'

◆ FORMAT_DATE_TIME5

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME5 = 'mm:ss'

◆ FORMAT_DATE_TIME6

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME6 = 'h:mm:ss'

◆ FORMAT_DATE_TIME7

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME7 = 'i:s.S'

◆ FORMAT_DATE_TIME8

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME8 = 'h:mm:ss;@'

◆ FORMAT_DATE_XLSX14

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX14 = 'mm-dd-yy'

◆ FORMAT_DATE_XLSX15

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15 = 'd-mmm-yy'

◆ FORMAT_DATE_XLSX16

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX16 = 'd-mmm'

◆ FORMAT_DATE_XLSX17

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX17 = 'mmm-yy'

◆ FORMAT_DATE_XLSX22

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'

◆ FORMAT_DATE_YYYYMMDD

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD = 'yyyy-mm-dd'

◆ FORMAT_DATE_YYYYMMDD2

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'

◆ FORMAT_DATE_YYYYMMDDSLASH

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH = 'yyyy/mm/dd;@'

◆ FORMAT_GENERAL

◆ FORMAT_NUMBER

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER = '0'

Definition at line 12 of file NumberFormat.php.

◆ FORMAT_NUMBER_00

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_00 = '0.00'

Definition at line 13 of file NumberFormat.php.

◆ FORMAT_NUMBER_COMMA_SEPARATED1

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00'

Definition at line 14 of file NumberFormat.php.

◆ FORMAT_NUMBER_COMMA_SEPARATED2

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-'

Definition at line 15 of file NumberFormat.php.

◆ FORMAT_PERCENTAGE

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE = '0%'

◆ FORMAT_PERCENTAGE_00

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00 = '0.00%'

◆ FORMAT_TEXT

const PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT = '@'

The documentation for this class was generated from the following file: