Update README.md

This commit is contained in:
Javier 2023-07-23 15:41:27 -03:00
parent b26e0dfc20
commit 8b1cdddee3
1 changed files with 9 additions and 2 deletions

View File

@ -34,6 +34,7 @@ or download class [here](https://github.com/shuchkin/simplexlsxgen/blob/master/s
## Examples
Use UTF-8 encoded strings.
### Data types
```php
$data = [
@ -127,8 +128,8 @@ $xlsx_cache = (string) (new Shuchkin\SimpleXLSXGen)->addSheet( $books, 'Modern s
// Classic interface
use Shuchkin\SimpleXLSXGen
$xlsx = new SimpleXLSXGen();
$xlsx->addSheet( $books, 'Catalog 2021' );
$xlsx->addSheet( $books2, 'Stephen King catalog');
$xlsx->addSheet($books, 'Catalog 2021');
$xlsx->addSheet($books2, 'Stephen King catalog');
$xlsx->downloadAs('books_2021.xlsx');
exit();
@ -218,6 +219,12 @@ function array2excel() {
</html>
```
## Notes
* When XLSX file is generated (__toString, saveAs or downloadAs methods), the data matrix of each sheet is traversed by rows and columns using foreach cycles. This implies freedom in the type of indexes used for the data but it also implies paying special attention when using numeric indexes since the array is traversed in the order in which they were defined and not in the numerical order of said indexes.
* The helper methods for setting and getting the styles of a range or cell, implies that the data was defined as a 2-dimensional array (matrix) with consecutive 0-based numeric indexes.
* If you use download or downloadAs methods, make sure you don't generate output before (not important if you use output buffering) and after you call the method. Pay special attention to whitespaces characters (space, cr/lf, tab) in source files before and after PHP code closing tags. If you inadvertently, or on purpose, generate text output, the resulting XLSX file will be corrupted.
## Debug
```php
ini_set('error_reporting', E_ALL );