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:
parent
620388a3f6
commit
6a098dd7e4
@ -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)
|
||||
|
||||
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)
|
||||
|
||||
## 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.11 (2020-05-21) removed XML unimportant attributes<br/>
|
||||
v0.9.10 (2020-05-20) initial release
|
@ -203,9 +203,12 @@ class SimpleXLSXGen {
|
||||
} elseif ( preg_match('/^(\d\d):(\d\d):(\d\d)$/', $v, $m ) ){
|
||||
$cv = $this->_date2excel(0,0,0,$m[1],$m[2],$m[3]);
|
||||
$cs = 4; // [14] mm-dd-yy
|
||||
} 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]);
|
||||
} 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] );
|
||||
$cs = 5; // [22] m/d/yy h:mm
|
||||
} elseif ( mb_strlen( $v ) > 160 ) {
|
||||
$ct = 'inlineStr';
|
||||
$cv = htmlentities( $v, ENT_QUOTES );
|
||||
} else {
|
||||
$ct = 's'; // shared string
|
||||
$v = htmlentities($v, ENT_QUOTES);
|
||||
@ -221,7 +224,8 @@ class SimpleXLSXGen {
|
||||
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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user