Additional work on number format masks
This commit is contained in:
parent
7c0208bd26
commit
21f5db0ca5
|
@ -592,8 +592,9 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
|
|||
return $value;
|
||||
}
|
||||
|
||||
// Convert any escaped characters to quoted strings, e.g. (\T to "T")
|
||||
// Convert any other escaped characters to quoted strings, e.g. (\T to "T")
|
||||
$format = preg_replace('/(\\\(.))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format);
|
||||
|
||||
// Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal)
|
||||
$sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format);
|
||||
|
||||
|
@ -630,6 +631,10 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
|
|||
break;
|
||||
}
|
||||
|
||||
// In Excel formats, "_" is used to add spacing,
|
||||
// The following character indicates the size of the spacing, which we can't do in HTML, so we just use a standard space
|
||||
$format = preg_replace('/_./', ' ', $format);
|
||||
|
||||
// Save format with color information for later use below
|
||||
$formatColor = $format;
|
||||
|
||||
|
@ -650,15 +655,6 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
|
|||
if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) {
|
||||
$value = 'EUR ' . sprintf('%1.2f', $value);
|
||||
} else {
|
||||
// In Excel formats, "_" is used to add spacing, which we can't do in HTML
|
||||
$format = preg_replace('/_./', '', $format);
|
||||
|
||||
// Some non-number characters are escaped with \, which we don't need
|
||||
$format = preg_replace("/\\\\/", '', $format);
|
||||
// Handle escaped characters, such as \" to display a literal " or \\ to display a literal \
|
||||
// $format = preg_replace('/(?<!\\\\)\"/', '', $format);
|
||||
// $format = str_replace(array('\\"', '*'), array('"', ''), $format);
|
||||
|
||||
// Some non-number strings are quoted, so we'll get rid of the quotes, likewise any positional * symbols
|
||||
$format = str_replace(array('"', '*'), '', $format);
|
||||
|
||||
|
@ -744,6 +740,9 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable
|
|||
}
|
||||
}
|
||||
|
||||
// Escape any escaped slashes to a single slash
|
||||
$format = preg_replace("/\\\\/u", '\\', $format);
|
||||
|
||||
// Additional formatting provided by callback function
|
||||
if ($callBack !== null) {
|
||||
list($writerInstance, $function) = $callBack;
|
||||
|
|
Loading…
Reference in New Issue