-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #12
- Loading branch information
Showing
4 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,12 +55,12 @@ If you want to append content dynamically, say from a loop, you can use the `app | |
{% endfor %} | ||
``` | ||
|
||
To generate an CSV: | ||
### To generate an CSV: | ||
```twig | ||
{% do beam.csv() %} | ||
``` | ||
|
||
To generate an XLSX: | ||
### To generate an XLSX: | ||
```twig | ||
{% do beam.xlsx() %} | ||
``` | ||
|
@@ -85,6 +85,35 @@ To overwrite the content: | |
[ '[email protected]', 'Jane Doe' ], | ||
[ '[email protected]', 'Trond Johansen' ], | ||
]) %} | ||
``` | ||
``` | ||
|
||
### Custom cell formatting is supported for XLSX: | ||
|
||
```twig | ||
{% set options = { | ||
header: ['Email', 'Name', { text: 'Number', type: 'number' }, { text: 'Date', type: 'date' }], | ||
content: [ | ||
[ '[email protected]', 'John Doe', 100000, '2022-06-10'], | ||
[ '[email protected]', 'Jane Doe', 252323, '2022-06-22'], | ||
[ '[email protected]', 'Trond Johansen', 30, '2022-06-22'], | ||
[ '[email protected]', 'Trond Johansen', 6233, '2023-06-22'], | ||
] | ||
} %} | ||
{% set beam = craft.beam.create(options) %} | ||
{% do beam.xlsx() %} | ||
``` | ||
|
||
These types are supported: | ||
|
||
| Format Type | Maps to the following cell format | | ||
|-------------|-------------------------------------------| | ||
| string | @ | | ||
| integer | 0 | | ||
| date | YYYY-MM-DD | | ||
| datetime | YYYY-MM-DD HH:MM:SS | | ||
| time | HH:MM:SS | | ||
| price | #,##0.00 | | ||
| dollar | [$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00 | | ||
| euro | #,##0.00 [$€-407];[RED]-#,##0.00 [$€-407] | | ||
|
||
Brought to you by [Superbig](https://superbig.co) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters