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

0.9.13 if string more 160 chars, save as inlineStr

This commit is contained in:
Sergey Shuchkin 2020-05-20 23:36:47 +06:00
parent 620388a3f6
commit 6a098dd7e4
2 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# SimpleXLSXGen class 0.9.12 (Official) # SimpleXLSXGen class 0.9.13 (Official)
[<img src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.herokuapp.com%2Fshuchkin" />](https://www.patreon.com/shuchkin) [<img src="https://img.shields.io/github/license/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/blob/master/license.md) [<img src="https://img.shields.io/github/stars/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/stargazers) [<img src="https://img.shields.io/github/forks/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/network) [<img src="https://img.shields.io/github/issues/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/issues) [<img src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.herokuapp.com%2Fshuchkin" />](https://www.patreon.com/shuchkin) [<img src="https://img.shields.io/github/license/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/blob/master/license.md) [<img src="https://img.shields.io/github/stars/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/stargazers) [<img src="https://img.shields.io/github/forks/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/network) [<img src="https://img.shields.io/github/issues/shuchkin/simplexlsxgen" />](https://github.com/shuchkin/simplexlsxgen/issues)
Export data to Excel XLSX file. PHP XLSX generator. No external tools and libraries.<br/> Export data to Excel XLSX file. PHP XLSX generator. No external tools and libraries.<br/>
@ -49,6 +49,7 @@ SimpleXLSXGen::fromArray( $data )->saveAs('datatypes.xlsx');
![XLSX screenshot](datatypes.png) ![XLSX screenshot](datatypes.png)
## History ## History
v0.9.13 (2020-05-21) if string more 160 chars, save as inlineStr<br/>
v0.9.12 (2020-05-21) readme fixed<br/> v0.9.12 (2020-05-21) readme fixed<br/>
v0.9.11 (2020-05-21) removed XML unimportant attributes<br/> v0.9.11 (2020-05-21) removed XML unimportant attributes<br/>
v0.9.10 (2020-05-20) initial release v0.9.10 (2020-05-20) initial release

View File

@ -206,6 +206,9 @@ class SimpleXLSXGen {
} elseif ( preg_match('/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/', $v, $m ) ) { } elseif ( preg_match('/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/', $v, $m ) ) {
$cv = $this->_date2excel( $m[1], $m[2], $m[3], $m[4], $m[5], $m[6] ); $cv = $this->_date2excel( $m[1], $m[2], $m[3], $m[4], $m[5], $m[6] );
$cs = 5; // [22] m/d/yy h:mm $cs = 5; // [22] m/d/yy h:mm
} elseif ( mb_strlen( $v ) > 160 ) {
$ct = 'inlineStr';
$cv = htmlentities( $v, ENT_QUOTES );
} else { } else {
$ct = 's'; // shared string $ct = 's'; // shared string
$v = htmlentities($v, ENT_QUOTES); $v = htmlentities($v, ENT_QUOTES);
@ -221,7 +224,8 @@ class SimpleXLSXGen {
continue; continue;
} }
$row .= '<c r="' . $cname . '"'.($ct ? ' t="'.$ct.'"' : '').($cs ? ' s="'.$cs.'"' : '').'><v>' . $cv . "</v></c>\r\n"; $row .= '<c r="' . $cname . '"'.($ct ? ' t="'.$ct.'"' : '').($cs ? ' s="'.$cs.'"' : '').'>'
.($ct === 'inlineStr' ? '<is><t>'.$cv.'</t></is>' : '<v>' . $cv . '</v>')."</c>\r\n";
} }
$ROWS[] = $row . "</row>\r\n"; $ROWS[] = $row . "</row>\r\n";
} }