README.md in ntq_excelsior-0.1.0 vs README.md in ntq_excelsior-0.2.0
- old
+ new
@@ -15,32 +15,46 @@
## Usage
### Export
```ruby
+# Exporter class
class UserExporter < NtqExcelsior::Exporter
+ styles ({
+ blue: {
+ fg_color: "2F5496",
+ }
+ })
+
schema ({
- name: 'Mobilités',
+ name: 'Utilisateurs',
extra_headers: [
[
{
title: "Utilisateurs",
- width: 4
+ width: 4,
+ styles: [:bold]
}
],
],
columns: [
{
title: 'Name',
resolve: -> (record) { [record.first_name, record.last_name].join(' ') },
+ styles: [:bold, :blue]
},
{
title: 'Email',
resolve: 'email'
},
{
+ title: 'Birthdate',
+ resolve: 'birthdate',
+ type: :date
+ }
+ {
title: 'Address (nested)',
resolve: ['address', 'address_one']
},
{
title: 'City (nested)',
@@ -49,9 +63,15 @@
]
})
end
+exporter = UserExporter.new(@users)
+exporter.export
+File.open("export.xlsx", "w") do |tpm|
+ tpm.binmode
+ tpm.write(file.to_stream.read)
+end
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.