init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
33
lib/PhpSpreadsheet/Reader/Xml/Style/NumberFormat.php
Normal file
33
lib/PhpSpreadsheet/Reader/Xml/Style/NumberFormat.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xml\Style;
|
||||
|
||||
use SimpleXMLElement;
|
||||
|
||||
class NumberFormat extends StyleBase
|
||||
{
|
||||
public function parseStyle(SimpleXMLElement $styleAttributes): array
|
||||
{
|
||||
$style = [];
|
||||
|
||||
$fromFormats = ['\-', '\ '];
|
||||
$toFormats = ['-', ' '];
|
||||
|
||||
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
|
||||
|
||||
switch ($styleAttributeValue) {
|
||||
case 'Short Date':
|
||||
$styleAttributeValue = 'dd/mm/yyyy';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($styleAttributeValue > '') {
|
||||
$style['numberFormat']['formatCode'] = $styleAttributeValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $style;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue