1
0
mirror of https://github.com/shuchkin/simplexlsxgen.git synced 2023-08-10 21:12:59 +03:00

Fixed real numbers in 123.45 format detection, fast shared strings index

This commit is contained in:
Sergey Shuchkin
2020-08-21 21:57:02 +06:00
parent 9824e5b25d
commit 9b2c9d3e1c
2 changed files with 6 additions and 5 deletions

View File

@ -190,12 +190,12 @@ class SimpleXLSXGen {
if ( preg_match( '/^[-+]?\d{1,18}$/', $v ) ) {
$cv = ltrim($v,'+');
} elseif ( preg_match('/^[-+]?\d+\.?\d*$/', $v ) ) {
} elseif ( preg_match('/^[-+]?\d+\.\d+$/', $v ) ) {
$cv = ltrim($v,'+');
} elseif ( preg_match('/^([-+]?\d+)%$/', $v, $m) ) {
$cv = round( $m[1] / 100, 2);
$cs = 1; // [9] 0%
} elseif ( preg_match('/^([-+]\d+\.\d*)%$/', $v, $m) ) {
} elseif ( preg_match('/^([-+]\d+\.\d+)%$/', $v, $m) ) {
$cv = round( $m[1] / 100, 4 );
$cs = 2; // [10] 0.00%
} elseif ( preg_match('/^(\d\d\d\d)-(\d\d)-(\d\d)$/', $v, $m ) ){
@ -214,7 +214,7 @@ class SimpleXLSXGen {
$ct = 's'; // shared string
$v = str_replace(['&','<','>'],['&amp;','&lt;','&gt;'], $v);
$cv = false;
if ( isset($SI_KEYS[$v]) && $SI[$SI_KEYS[$v]] === $v ) {
if ( isset($SI_KEYS[$v]) ) {
$cv = $SI_KEYS[$v];
}