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9CĞ'"PLbs7Ԏ$ ]\Ԭq"Iyvҍh&wpn"}Q8J'>RB?n7=gDt*r)]hA)%ٲc`2LBeT{9-pz(j-ښ*S_uӏw-,yŠu!>״xv,'W,S CVN~߮:檶(R..LS:"e?zٴU(Әr~(bhIgrP`H1 &P0.YjgMW)Iu (y̤gup0F ~u PĎK7rJYѽD;̮0^t ۣp+׏  RXQS{:nٹpr 9 EfSC便 K lSF#O;=%]n,KT- z ' 7qL~1#9{ z=BvNIx&RoFڍ  hx[g(4z@;G2pM4i ivBe_aNXhZ(╒>*;اo۬`Fx6~jW/8{ZX5FVس0er(2TByXИ j$ >:u6(?}%%g̏?Ik\+WK߼Iu3yϻe.'$ >:u6(?}ϋU}, % \c8ܶlzjsMoE.XMeƀO痾K͡WkAGC*Q:϶[.\X{om".)0\7h r䛠t5!ݮ0>6.+xP-ߐ̲q@;n/=Ú  Ny]ҩ5fg:PP7Sf^7J,):ܺ^Ѝg{:״K3]" ZuQMZ`'b$~ `LUP㡞lkqҴ|[?a +Lz3?'aM _r4/JW<*tYw'v'KPg7p P{ܩYSK.!єA5$'2_ݠH"C.`խ 7@ ԸD[/B; I5W˫L1?Hp Z߻I*>Dۇ>w &጗7u:Ei׿ ĢQ$3 ĢQ$3AZ&#UkLJqwߛ<7, z@Sc_V@? ٓj4ڴi;]"C+%YnTA its ramifications are * @param 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 */ public function __construct($isSupervisor = false, $isConditional = false) { // Supervisor? parent::__construct($isSupervisor); if ($isConditional) { $this->formatCode = null; $this->builtInFormatCode = false; } } /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor. * * @return NumberFormat */ public function getSharedComponent() { /** @var Style */ $parent = $this->parent; return $parent->getSharedComponent()->getNumberFormat(); } /** * Build style array from subcomponents. * * @param array $array * * @return array */ public function getStyleArray($array) { return ['numberFormat' => $array]; } /** * Apply styles from array. * * * $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( * [ * 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE * ] * ); * * * @param array $styleArray Array containing style information * * @return $this */ public function applyFromArray(array $styleArray) { if ($this->isSupervisor) { $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($styleArray)); } else { if (isset($styleArray['formatCode'])) { $this->setFormatCode($styleArray['formatCode']); } } return $this; } /** * Get Format Code. * * @return null|string */ public function getFormatCode() { if ($this->isSupervisor) { return $this->getSharedComponent()->getFormatCode(); } if (is_int($this->builtInFormatCode)) { return self::builtInFormatCode($this->builtInFormatCode); } return $this->formatCode; } /** * Set Format Code. * * @param string $formatCode see self::FORMAT_* * * @return $this */ public function setFormatCode(string $formatCode) { if ($formatCode == '') { $formatCode = self::FORMAT_GENERAL; } if ($this->isSupervisor) { $styleArray = $this->getStyleArray(['formatCode' => $formatCode]); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); } else { $this->formatCode = $formatCode; $this->builtInFormatCode = self::builtInFormatCodeIndex($formatCode); } return $this; } /** * Get Built-In Format Code. * * @return false|int */ public function getBuiltInFormatCode() { if ($this->isSupervisor) { return $this->getSharedComponent()->getBuiltInFormatCode(); } // Scrutinizer says this could return true. It is wrong. return $this->builtInFormatCode; } /** * Set Built-In Format Code. * * @param int $formatCodeIndex Id of the built-in format code to use * * @return $this */ public function setBuiltInFormatCode(int $formatCodeIndex) { if ($this->isSupervisor) { $styleArray = $this->getStyleArray(['formatCode' => self::builtInFormatCode($formatCodeIndex)]); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); } else { $this->builtInFormatCode = $formatCodeIndex; $this->formatCode = self::builtInFormatCode($formatCodeIndex); } return $this; } /** * Fill built-in format codes. */ private static function fillBuiltInFormatCodes(): void { // [MS-OI29500: Microsoft Office Implementation Information for ISO/IEC-29500 Standard Compliance] // 18.8.30. numFmt (Number Format) // // The ECMA standard defines built-in format IDs // 14: "mm-dd-yy" // 22: "m/d/yy h:mm" // 37: "#,##0 ;(#,##0)" // 38: "#,##0 ;[Red](#,##0)" // 39: "#,##0.00;(#,##0.00)" // 40: "#,##0.00;[Red](#,##0.00)" // 47: "mmss.0" // KOR fmt 55: "yyyy-mm-dd" // Excel defines built-in format IDs // 14: "m/d/yyyy" // 22: "m/d/yyyy h:mm" // 37: "#,##0_);(#,##0)" // 38: "#,##0_);[Red](#,##0)" // 39: "#,##0.00_);(#,##0.00)" // 40: "#,##0.00_);[Red](#,##0.00)" // 47: "mm:ss.0" // KOR fmt 55: "yyyy/mm/dd" // Built-in format codes if (empty(self::$builtInFormats)) { self::$builtInFormats = []; // General self::$builtInFormats[0] = self::FORMAT_GENERAL; self::$builtInFormats[1] = '0'; self::$builtInFormats[2] = '0.00'; self::$builtInFormats[3] = '#,##0'; self::$builtInFormats[4] = '#,##0.00'; self::$builtInFormats[9] = '0%'; self::$builtInFormats[10] = '0.00%'; self::$builtInFormats[11] = '0.00E+00'; self::$builtInFormats[12] = '# ?/?'; self::$builtInFormats[13] = '# ??/??'; self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy'; self::$builtInFormats[15] = 'd-mmm-yy'; self::$builtInFormats[16] = 'd-mmm'; self::$builtInFormats[17] = 'mmm-yy'; self::$builtInFormats[18] = 'h:mm AM/PM'; self::$builtInFormats[19] = 'h:mm:ss AM/PM'; self::$builtInFormats[20] = 'h:mm'; self::$builtInFormats[21] = 'h:mm:ss'; self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm'; self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)'; self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)'; self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)'; self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)'; self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'; self::$builtInFormats[45] = 'mm:ss'; self::$builtInFormats[46] = '[h]:mm:ss'; self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0'; self::$builtInFormats[48] = '##0.0E+0'; self::$builtInFormats[49] = '@'; // CHT self::$builtInFormats[27] = '[$-404]e/m/d'; self::$builtInFormats[30] = 'm/d/yy'; self::$builtInFormats[36] = '[$-404]e/m/d'; self::$builtInFormats[50] = '[$-404]e/m/d'; self::$builtInFormats[57] = '[$-404]e/m/d'; // THA self::$builtInFormats[59] = 't0'; self::$builtInFormats[60] = 't0.00'; self::$builtInFormats[61] = 't#,##0'; self::$builtInFormats[62] = 't#,##0.00'; self::$builtInFormats[67] = 't0%'; self::$builtInFormats[68] = 't0.00%'; self::$builtInFormats[69] = 't# ?/?'; self::$builtInFormats[70] = 't# ??/??'; // JPN self::$builtInFormats[28] = '[$-411]ggge"年"m"月"d"日"'; self::$builtInFormats[29] = '[$-411]ggge"年"m"月"d"日"'; self::$builtInFormats[31] = 'yyyy"年"m"月"d"日"'; self::$builtInFormats[32] = 'h"時"mm"分"'; self::$builtInFormats[33] = 'h"時"mm"分"ss"秒"'; self::$builtInFormats[34] = 'yyyy"年"m"月"'; self::$builtInFormats[35] = 'm"月"d"日"'; self::$builtInFormats[51] = '[$-411]ggge"年"m"月"d"日"'; self::$builtInFormats[52] = 'yyyy"年"m"月"'; self::$builtInFormats[53] = 'm"月"d"日"'; self::$builtInFormats[54] = '[$-411]ggge"年"m"月"d"日"'; self::$builtInFormats[55] = 'yyyy"年"m"月"'; self::$builtInFormats[56] = 'm"月"d"日"'; self::$builtInFormats[58] = '[$-411]ggge"年"m"月"d"日"'; // Flip array (for faster lookups) self::$flippedBuiltInFormats = array_flip(self::$builtInFormats); } } /** * Get built-in format code. * * @param int $index * * @return string */ public static function builtInFormatCode($index) { // Clean parameter $index = (int) $index; // Ensure built-in format codes are available self::fillBuiltInFormatCodes(); // Lookup format code if (isset(self::$builtInFormats[$index])) { return self::$builtInFormats[$index]; } return ''; } /** * Get built-in format code index. * * @param string $formatCodeIndex * * @return false|int */ public static function builtInFormatCodeIndex($formatCodeIndex) { // Ensure built-in format codes are available self::fillBuiltInFormatCodes(); // Lookup format code if (array_key_exists($formatCodeIndex, self::$flippedBuiltInFormats)) { return self::$flippedBuiltInFormats[$formatCodeIndex]; } return false; } /** * Get hash code. * * @return string Hash code */ public function getHashCode() { if ($this->isSupervisor) { return $this->getSharedComponent()->getHashCode(); } return md5( $this->formatCode . $this->builtInFormatCode . __CLASS__ ); } /** * Convert a value in a pre-defined format to a PHP string. * * @param mixed $value Value to format * @param string $format Format code: see = self::FORMAT_* for predefined values; * or can be any valid MS Excel custom format string * @param array $callBack Callback function for additional formatting of string * * @return string Formatted string */ public static function toFormattedString($value, $format, $callBack = null) { return NumberFormat\Formatter::toFormattedString($value, $format, $callBack); } protected function exportArray1(): array { $exportedArray = []; $this->exportArray2($exportedArray, 'formatCode', $this->getFormatCode()); return $exportedArray; } }