1
0
mirror of https://github.com/shuchkin/simplexlsxgen.git synced 2023-08-10 21:12:59 +03:00
This commit is contained in:
Sergey Shuchkin 2022-08-06 23:13:06 +06:00
parent aef6ee4935
commit 82b0db1f8e
3 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,10 @@
# Changelog
## 1.2.16 (2022-08-06)
* added modTemplate( $path, $custom_xml ) for customize generated XML
```php
$xlsx->modTemplate('xl/worksheets/sheet1.xml', '<autoFilter ref="A1:A5"/>');
```
## 1.2.15 (2022-07-05)
* added wrap words in long strings `<wraptext>long long line</wraptext>`

View File

@ -104,6 +104,10 @@ $xlsx->addSheet( $books, 'Catalog 2021' );
$xlsx->addSheet( $books2, 'Stephen King catalog');
$xlsx->downloadAs('books_2021.xlsx');
exit();
// Customize XML
$xlsx->modTemplate('xl/worksheets/sheet1.xml', '<autoFilter ref="A1:A5"/>');
```
### JS array to Excel (AJAX)
```php

View File

@ -768,6 +768,11 @@ class SimpleXLSXGen {
$this->defaultFontSize = $size;
return $this;
}
public function modTemplate( $path, $custom_xml ) {
$t = $this->template[ $path ];
$p = strrpos($t,'</');
return $this->template[ $path ] = substr($t, 0, $p) . $custom_xml . substr($t,$p);
}
public function mergeCells( $range ) {
$this->sheets[$this->curSheet]['mergecells'][] = $range;
return $this;