mirror of
https://github.com/shuchkin/simplexlsxgen.git
synced 2023-08-10 21:12:59 +03:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
ff3f016358 | |||
bcd3586731 | |||
402c6b9417 | |||
5840fd5285 | |||
4543922330 | |||
d49f8996df | |||
5309e6a002 | |||
ab28bc319d | |||
e145bd5777 | |||
2ee7237016 | |||
a0a932e2f5 | |||
fc884044ac | |||
d84c842d38 | |||
0dafc8bf9e | |||
82f19a9f35 | |||
139602c340 | |||
ac34d8f527 | |||
c55d77c63e | |||
c3d10db967 | |||
1c206d06bc | |||
f0cbc32af9 | |||
121f1222c2 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
vendor*
|
||||
/vendor*
|
||||
/books.fw.png
|
||||
/datatypes.fw.png
|
||||
/styles.fw.png
|
||||
/.gitignore
|
||||
|
16
CHANGELOG.md
16
CHANGELOG.md
@ -1,5 +1,21 @@
|
||||
# Changelog
|
||||
|
||||
## 1.2.11 (2022-)
|
||||
* Row height `<style height="50">Custom row height 50</style>`
|
||||
|
||||
## 1.2.10 (2022-04-24)
|
||||
* Added colors `<style color="#FFFF00" bgcolor="#00FF00">Yellow text on blue background</style>`, thx [mrjemson](https://github.com/mrjemson)
|
||||
|
||||
## 1.1.12 (2022-03-15)
|
||||
* Added `$xlsx->mergeCells('A1:C1')`
|
||||
|
||||
## 1.1.11 (2022-02-05)
|
||||
* sheet name maximum length is 31 chars, mb_substr used now
|
||||
* license fixed
|
||||
|
||||
## 1.1.10 (2022-02-05)
|
||||
* namespace added, use Shuchkin\SimpleXLSXGen
|
||||
|
||||
## 1.0.23 (2022-02-01)
|
||||
* fixed dates if year < 1900 and time only cells, thx [fapth](https://github.com/shuchkin/simplexlsxgen/issues/51)
|
||||
|
||||
|
26
README.md
26
README.md
@ -1,8 +1,10 @@
|
||||
# SimpleXLSXGen
|
||||
[<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/>
|
||||
(!) XLSX reader [here](https://github.com/shuchkin/simplexlsx).
|
||||
Export data to Excel XLSX file. PHP XLSX generator. No external tools and libraries.
|
||||
- XLSX reader [here](https://github.com/shuchkin/simplexlsx)
|
||||
- XLS reader [here](https://github.com/shuchkin/simplexls)
|
||||
- CSV reader/writer [here](https://github.com/shuchkin/simplecsv)
|
||||
|
||||
**Sergey Shuchkin** <sergey.shuchkin@gmail.com> 2020-2021<br/>
|
||||
|
||||
@ -15,7 +17,7 @@ $books = [
|
||||
[618260307, 'The Hobbit', 'J. R. R. Tolkien', 'Houghton Mifflin', 'USA'],
|
||||
[908606664, 'Slinky Malinki', 'Lynley Dodd', 'Mallinson Rendel', 'NZ']
|
||||
];
|
||||
$xlsx = SimpleXLSXGen::fromArray( $books );
|
||||
$xlsx = Shuchkin\SimpleXLSXGen::fromArray( $books );
|
||||
$xlsx->saveAs('books.xlsx'); // or downloadAs('books.xlsx') or $xlsx_content = (string) $xlsx
|
||||
```
|
||||

|
||||
@ -46,7 +48,7 @@ $data = [
|
||||
['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');
|
||||
Shuchkin\SimpleXLSXGen::fromArray( $data )->saveAs('datatypes.xlsx');
|
||||
```
|
||||

|
||||
|
||||
@ -61,14 +63,19 @@ $data = [
|
||||
['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>'],
|
||||
['Green', '<style color="#00FF00">12345.67</style>'],
|
||||
['Bold Red Text', '<b><style color="#FF0000">12345.67</style></b>'],
|
||||
['Blue Text and Yellow Fill', '<style bgcolor="#FFFF00" color="#0000FF">12345.67</style>'],
|
||||
['Left', '<left>12345.67</left>'],
|
||||
['Center', '<center>12345.67</center>'],
|
||||
['Right', '<right>Right Text</right>'],
|
||||
['Center + Bold', '<center><b>Name</b></center>']
|
||||
['Center + Bold', '<center><b>Name</b></center>'],
|
||||
['<center>MERGE CELLS</center>', null]
|
||||
];
|
||||
SimpleXLSXGen::fromArray( $data )
|
||||
->setDefaultFont( 'Courier New' )
|
||||
->setDefaultFontSize( 14 )
|
||||
->mergeCells('A16:B16')
|
||||
->saveAs('styles_and_tags.xlsx');
|
||||
```
|
||||

|
||||
@ -76,15 +83,16 @@ SimpleXLSXGen::fromArray( $data )
|
||||
### More examples
|
||||
```php
|
||||
// Fluid interface, output to browser for download
|
||||
SimpleXLSXGen::fromArray( $books )->downloadAs('table.xlsx');
|
||||
Shuchkin\SimpleXLSXGen::fromArray( $books )->downloadAs('table.xlsx');
|
||||
|
||||
// Fluid interface, multiple sheets
|
||||
SimpleXLSXGen::fromArray( $books )->addSheet( $books2 )->download();
|
||||
Shuchkin\SimpleXLSXGen::fromArray( $books )->addSheet( $books2 )->download();
|
||||
|
||||
// Alternative interface, sheet name, get xlsx content
|
||||
$xlsx_cache = (string) (new SimpleXLSXGen)->addSheet( $books, 'Modern style');
|
||||
$xlsx_cache = (string) (new Shuchkin\SimpleXLSXGen)->addSheet( $books, 'Modern style');
|
||||
|
||||
// Classic interface
|
||||
use Shuchkin\SimpleXLSXGen
|
||||
$xlsx = new SimpleXLSXGen();
|
||||
$xlsx->addSheet( $books, 'Catalog 2021' );
|
||||
$xlsx->addSheet( $books2, 'Stephen King catalog');
|
||||
@ -101,5 +109,5 @@ $data = [
|
||||
['Debug', 123]
|
||||
];
|
||||
|
||||
SimpleXLSXGen::fromArray( $data )->saveAs('debug.xlsx');
|
||||
Shuchkin\SimpleXLSXGen::fromArray( $data )->saveAs('debug.xlsx');
|
||||
```
|
||||
|
@ -17,6 +17,7 @@
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"ext-mbstring": "*",
|
||||
"ext-zlib": "*"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Lukas Martinelli
|
||||
Copyright (c) 2020-2022 Sergey Shuchkin sergey.shuchkin@gmail.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
File diff suppressed because it is too large
Load Diff
BIN
styles.png
BIN
styles.png
Binary file not shown.
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user