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

4 Commits

Author SHA1 Message Date
a8093b9d8e Merge remote-tracking branch 'origin/master' 2020-10-04 16:08:32 +06:00
a9219575df disable type detection 2020-10-04 16:08:12 +06:00
476e083f29 Merge pull request #8 from jturbide/master
Fix invalid content
2020-08-28 00:26:29 +06:00
db598d4ee4 Update SimpleXLSXGen.php 2020-08-26 17:15:14 -04:00
2 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# SimpleXLSXGen class 0.9.19 (Official)
# SimpleXLSXGen class 0.9.20 (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)
Export data to Excel XLSX file. PHP XLSX generator. No external tools and libraries.<br/>
@ -42,8 +42,9 @@ $data = [
['Procent', '12%'],
['Datetime', '2020-05-20 02:38:00'],
['Date','2020-05-20'],
['Time','02:38:00'],
['String', 'See SimpleXLSXGen column autosize feature']
['Time','02:38:00'],
['String', 'See SimpleXLSXGen column autosize feature'],
['Disable Type Detection', "\0".'2020-10-04 16:02:00']
];
SimpleXLSXGen::fromArray( $data )->saveAs('datatypes.xlsx');
```
@ -62,6 +63,7 @@ SimpleXLSXGen::fromArray( $data )->saveAs('debug.xlsx');
## History
V0.9.20 (2020-10-04) Disable type detection if string started \0
v0.9.19 (2020-08-23) Numbers like SKU right aligned now<br/>
v0.9.18 (2020-08-22) Fixed fast shared strings index<br/>
v0.9.17 (2020-08-21) Fixed real numbers in 123.45 format detection, fast shared strings index (thx fredriksundin)<br/>

View File

@ -216,13 +216,14 @@ class SimpleXLSXGen {
$cs = 6; // [22] m/d/yy h:mm
} elseif ( mb_strlen( $v ) > 160 ) {
$ct = 'inlineStr';
$cv = str_replace(['&','<','>'],['&amp;','&lt;','&gt;'], $v);
$cv = str_replace(['&','<','>',"\x03"],['&amp;','&lt;','&gt;',''], $v);
} else {
if ( preg_match('/^[0-9+-.]+$/', $v ) ) { // Long ?
$cs = 7; // Align Right
}
$v = ltrim($v,"\0"); // disabled type detection
$ct = 's'; // shared string
$v = str_replace(['&','<','>'],['&amp;','&lt;','&gt;'], $v);
$v = str_replace(['&','<','>',"\x03"],['&amp;','&lt;','&gt;',''], $v);
$cv = false;
$skey = '~'.$v;
if ( isset($SI_KEYS[ $skey ]) ) {