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 2021-05-03 03:22:26 +06:00
parent eeec88dbf0
commit 860da7f493

View File

@ -42,11 +42,11 @@ $data = [
['Time','02:38:00'],
['Datetime PHP', new DateTime('2021-02-06 21:07:00')],
['String', 'Long UTF-8 String in autoresized column'],
['Hyperlink', 'https://github.com/shuchkin/simplexlsxgen'],
['Hyperlink + Anchor', '<a href="https://github.com/shuchkin/simplexlsxgen">SimpleXLSXGen</a>'],
['Hyperlink', 'https://github.com/shuchkin/simplexlsxgen'],
['Hyperlink + Anchor', '<a href="https://github.com/shuchkin/simplexlsxgen">SimpleXLSXGen</a>'],
['RAW string', "\0".'2020-10-04 16:02:00']
];
SimpleXLSXGen::fromArray( $data )->saveAs('datatypes.xlsx'); // or ->downloadAs('datatypes.xlsx');
SimpleXLSXGen::fromArray( $data )->saveAs('datatypes.xlsx');
```
![XLSX screenshot](datatypes.png)
### Fluid examples
@ -65,23 +65,23 @@ $xlsx->downloadAs('books_2021.xlsx');
### Formatting
```php
$data = [
['Normal', '12345.67'],
['Bold', '<b>12345.67</b>'],
['Italic', '<i>12345.67</i>'],
['Underline', '<u>12345.67</u>'],
['Strike', '<s>12345.67</s>'],
['Bold + Italic', '<b><i>12345.67</i></b>'],
['Hyperlink', 'https://github.com/shuchkin/simplexlsxgen'],
['Italic + Hyperlink + Anchor', '<i><a href="https://github.com/shuchkin/simplexlsxgen">SimpleXLSXGen</a></i>'],
['Left', '<left>12345.67</left>'],
['Center', '<center>12345.67</center>'],
['Right', '<right>Right Text</right>'],
['Center + Bold', '<center><b>Name</b></center>']
['Normal', '12345.67'],
['Bold', '<b>12345.67</b>'],
['Italic', '<i>12345.67</i>'],
['Underline', '<u>12345.67</u>'],
['Strike', '<s>12345.67</s>'],
['Bold + Italic', '<b><i>12345.67</i></b>'],
['Hyperlink', 'https://github.com/shuchkin/simplexlsxgen'],
['Italic + Hyperlink + Anchor', '<i><a href="https://github.com/shuchkin/simplexlsxgen">SimpleXLSXGen</a></i>'],
['Left', '<left>12345.67</left>'],
['Center', '<center>12345.67</center>'],
['Right', '<right>Right Text</right>'],
['Center + Bold', '<center><b>Name</b></center>']
];
SimpleXLSXGen::fromArray( $data )
->setDefaultFont( 'Courier New' )
->setDefaultFontSize( 14 )
->saveAs('styles_and_tags.xlsx');
->setDefaultFont( 'Courier New' )
->setDefaultFontSize( 14 )
->saveAs('styles_and_tags.xlsx');
```
![XLSX screenshot](styles.png)
### Debug