|
Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
|
Public Member Functions | |
| __construct (bool $isSupervisor=false, bool $isConditional=false) | |
| Create a new NumberFormat. | |
| __clone () | |
| Implement PHP __clone to create a deep clone, not just a shallow copy. | |
| applyFromArray (array $styleArray) | |
| Apply styles from array. | |
| bindParent (Spreadsheet|self $parent, ?string $parentPropertyName=null) | |
| Bind parent. | |
| exportArray () | |
| Export style as array. | |
| getActiveCell () | |
| Get the currently active cell coordinate in currently active sheet. | |
| getActiveSheet () | |
| Get the currently active sheet. | |
| getBuiltInFormatCode () | |
| Get Built-In Format Code. | |
| getFormatCode (bool $extended=false) | |
| Get Format Code. | |
| getHashCode () | |
| Get hash code. | |
| getIsSupervisor () | |
| Is this a supervisor or a cell style component? | |
| getSelectedCells () | |
| Get the currently active cell coordinate in currently active sheet. | |
| getSharedComponent () | |
| Get the shared style component for the currently active cell in currently active sheet. | |
| getStyleArray (array $array) | |
| Build style array from subcomponents. | |
| setBuiltInFormatCode (int $formatCodeIndex) | |
| Set Built-In Format Code. | |
| setFormatCode (string $formatCode) | |
| Set Format Code. | |
Static Public Member Functions | |
| static | builtInFormatCode (int $index) |
| Get built-in format code. | |
| static | builtInFormatCodeIndex (string $formatCodeIndex) |
| Get built-in format code index. | |
| static | convertSystemFormats (?string $formatCode) |
| static | getDateTimeFormat () |
| static | getLongDateFormat () |
| static | getShortDateFormat () |
| static | getTimeFormat () |
| static | setDateTimeFormat (string $dateTimeFormat) |
| static | setLongDateFormat (string $longDateFormat) |
| static | setShortDateFormat (string $shortDateFormat) |
| static | setTimeFormat (string $timeFormat) |
| static | toFormattedString (mixed $value, string $format, ?array $callBack=null) |
| Convert a value in a pre-defined format to a PHP string. | |
Public Attributes | |
| const | DATE_TIME_INDEX = 22 |
| const | DATE_TIME_OR_DATETIME_ARRAY |
| const | FORMAT_ACCOUNTING_EUR = '_("€"* #,##0.00_);_("€"* (#,##0.00::);_("€"* "-"??_);_(@_)' |
| const | FORMAT_ACCOUNTING_USD = '_("$"* #,##0.00_);_("$"* (#,##0.00::);_("$"* "-"??_);_(@_)' |
| const | FORMAT_CURRENCY_EUR = '#,##0.00_-[$€]' |
| const | FORMAT_CURRENCY_EUR_INTEGER = '#,##0_-[$€]' |
| const | FORMAT_CURRENCY_USD = '$#,##0.00_-' |
| const | FORMAT_CURRENCY_USD_INTEGER = '$#,##0_-' |
| const | FORMAT_DATE_DATETIME = 'd/m/yy h:mm' |
| const | FORMAT_DATE_DDMMYYYY = 'dd/mm/yyyy' |
| const | FORMAT_DATE_DMMINUS = 'd-m' |
| const | FORMAT_DATE_DMYMINUS = 'd-m-yy' |
| const | FORMAT_DATE_DMYSLASH = 'd/m/yy' |
| const | FORMAT_DATE_LONG_DATE = 'dddd, mmmm d, yyyy' |
| const | FORMAT_DATE_MYMINUS = 'm-yy' |
| 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_XLSX14 = 'mm-dd-yy' |
| const | FORMAT_DATE_XLSX14_ACTUAL = 'm/d/yyyy' |
| 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_XLSX22_ACTUAL = 'm/d/yyyy h:mm' |
| const | FORMAT_DATE_YYYYMMDD = 'yyyy-mm-dd' |
| const | FORMAT_DATE_YYYYMMDDSLASH = 'yyyy/mm/dd;@' |
| const | FORMAT_GENERAL = 'General' |
| const | FORMAT_NUMBER = '0' |
| const | FORMAT_NUMBER_0 = '0.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_0 = '0.0%' |
| const | FORMAT_PERCENTAGE_00 = '0.00%' |
| const | FORMAT_SYSDATE_F800 = '[$-F800]' |
| const | FORMAT_SYSDATE_X = '[$-x-sysdate]' |
| const | FORMAT_SYSTIME_F400 = '[$-F400]' |
| const | FORMAT_SYSTIME_X = '[$-x-systime]' |
| const | FORMAT_TEXT = '@' |
| const | SHORT_DATE_INDEX = 14 |
| const | TIME_OR_DATETIME_ARRAY |
Protected Member Functions | |
| exportArray1 () | |
| Abstract method to be implemented in anything which extends this class. | |
| exportArray2 (array &$exportedArray, string $index, mixed $objOrValue) | |
| Populate array from exportArray1. | |
Protected Attributes | |
| false int | $builtInFormatCode = 0 |
| Built-in format Code. | |
| string | $formatCode = self::FORMAT_GENERAL |
| Format Code. | |
| bool | $isSupervisor |
| Spreadsheet Supervisor | $parent |
| Parent. | |
| string | $parentPropertyName = null |
| Parent property name. | |
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::__construct | ( | bool | $isSupervisor = false, |
| bool | $isConditional = false ) |
Create a new NumberFormat.
| bool | $isSupervisor | Flag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are |
| bool | $isConditional | Flag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are |
|
inherited |
Implement PHP __clone to create a deep clone, not just a shallow copy.
Reimplemented in PhpOffice\PhpSpreadsheet\Style\Font.
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::applyFromArray | ( | array | $styleArray | ) |
Apply styles from array.
$spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( [ 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE ] );
| array | $styleArray | Array containing style information |
| $this |
|
inherited |
Bind parent.
Only used for supervisor.
| $this |
|
static |
Get built-in format code index.
| false|int |
|
finalinherited |
Export style as array.
Available to anything which extends this class: Alignment, Border, Borders, Color, Fill, Font, NumberFormat, Protection, and Style.
|
protected |
Abstract method to be implemented in anything which extends this class.
This method invokes exportArray2 with the names and values of all properties to be included in output array, returning that array to exportArray, then to caller.
Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.
|
finalprotectedinherited |
Populate array from exportArray1.
This method is available to anything which extends this class. The parameter index is the key to be added to the array. The parameter objOrValue is either a primitive type, which is the value added to the array, or a Style object to be recursively added via exportArray.
|
inherited |
Get the currently active cell coordinate in currently active sheet.
Only used for supervisor.
| string | E.g. 'A1' |
|
inherited |
Get the currently active sheet.
Only used for supervisor.
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::getBuiltInFormatCode | ( | ) |
Get Built-In Format Code.
| false|int |
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::getHashCode | ( | ) |
|
inherited |
Get the currently active cell coordinate in currently active sheet.
Only used for supervisor.
| string | E.g. 'A1' |
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::getSharedComponent | ( | ) |
Get the shared style component for the currently active cell in currently active sheet.
Only used for style supervisor.
Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::getStyleArray | ( | array | $array | ) |
Build style array from subcomponents.
Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::setBuiltInFormatCode | ( | int | $formatCodeIndex | ) |
Set Built-In Format Code.
| int | $formatCodeIndex | Id of the built-in format code to use |
| $this |
| PhpOffice\PhpSpreadsheet\Style\NumberFormat::setFormatCode | ( | string | $formatCode | ) |
Set Format Code.
| string | $formatCode | see self::FORMAT_* |
| $this |
|
static |
Convert a value in a pre-defined format to a PHP string.
| null | bool | float | int | RichText | string | $value | Value to format |
| string | $format | Format code: see = self::FORMAT_* for predefined values; or can be any valid MS Excel custom format string |
| ?array | $callBack | Callback function for additional formatting of string |
| string | Formatted string |
|
protectedinherited |
Parent.
Only used for supervisor.
| const PhpOffice\PhpSpreadsheet\Style\NumberFormat::DATE_TIME_OR_DATETIME_ARRAY |
| const PhpOffice\PhpSpreadsheet\Style\NumberFormat::TIME_OR_DATETIME_ARRAY |