to_spreadsheet 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,14 +64,14 @@ bc. format_xls 'table.my-table' do
64
64
  workbook use_autowidth: true
65
65
  sheet orientation: landscape
66
66
  format 'th', b: true # bold
67
- format 'tbody tr', color: lambda { |row| 'ddffdd' if row.index.odd? }
67
+ format 'tbody tr', bg_color: lambda { |row| 'ddffdd' if row.index.odd? }
68
68
  format 'A3:B10', i: true # italic
69
69
  format column: 0, width: 35
70
70
  format 'td.custom', lambda { |cell| modify cell somehow.}
71
71
  # default value (fallback value when value is blank or 0 for integer / float)
72
72
  default 'td.price', 10
73
73
 
74
- For the full list of supported properties head here: http://rubydoc.info/github/randym/axlsx/Axlsx/Cell
74
+ For the full list of supported properties head here: http://rubydoc.info/github/randym/axlsx/Axlsx/Styles#add_style-instance_method
75
75
  In addition, for column formats, Axlsx columnInfo properties are also supported
76
76
 
77
77
  h3. Themes
@@ -79,7 +79,7 @@ h3. Themes
79
79
  You can define "themes" - blocks of formatting code:
80
80
 
81
81
  bc. ToSpreadsheet.theme :zebra do
82
- format 'tr', color: lambda { |row| 'ddffdd' if row.index.odd? }
82
+ format 'tr', bg_color: lambda { |row| 'ddffdd' if row.index.odd? }
83
83
 
84
84
  And then use them:
85
85
 
@@ -7,7 +7,7 @@ require 'action_controller/metal/responder'
7
7
  ActionController::Renderers.add :xlsx do |template, options|
8
8
  filename = options[:filename] || options[:template] || 'data'
9
9
  data = ToSpreadsheet::Context.with_context ToSpreadsheet::Context.global.merge(ToSpreadsheet::Context.new) do |context|
10
- html = render_to_string(template, options.merge(template: template.to_s, formats: ['html']))
10
+ html = render_to_string(template, options.merge(template: template.to_s, formats: ['xlsx', 'html']))
11
11
  ToSpreadsheet::Renderer.to_data(html, context)
12
12
  end
13
13
  send_data data, type: :xlsx, disposition: %(attachment; filename="#{filename}.xlsx")
@@ -1,3 +1,3 @@
1
1
  module ToSpreadsheet
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -2,111 +2,111 @@
2
2
  name: to_spreadsheet
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gleb Mazovetskiy
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: rails
15
16
  version_requirements: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
- none: false
21
- name: rails
22
- type: :runtime
23
- prerelease: false
24
22
  requirement: !ruby/object:Gem::Requirement
23
+ none: false
25
24
  requirements:
26
25
  - - ! '>='
27
26
  - !ruby/object:Gem::Version
28
27
  version: '0'
29
- none: false
28
+ type: :runtime
29
+ prerelease: false
30
30
  - !ruby/object:Gem::Dependency
31
+ name: nokogiri
31
32
  version_requirements: !ruby/object:Gem::Requirement
33
+ none: false
32
34
  requirements:
33
35
  - - ! '>='
34
36
  - !ruby/object:Gem::Version
35
37
  version: '0'
36
- none: false
37
- name: nokogiri
38
- type: :runtime
39
- prerelease: false
40
38
  requirement: !ruby/object:Gem::Requirement
39
+ none: false
41
40
  requirements:
42
41
  - - ! '>='
43
42
  - !ruby/object:Gem::Version
44
43
  version: '0'
45
- none: false
44
+ type: :runtime
45
+ prerelease: false
46
46
  - !ruby/object:Gem::Dependency
47
+ name: axlsx
47
48
  version_requirements: !ruby/object:Gem::Requirement
49
+ none: false
48
50
  requirements:
49
51
  - - ! '>='
50
52
  - !ruby/object:Gem::Version
51
53
  version: '0'
52
- none: false
53
- name: axlsx
54
- type: :runtime
55
- prerelease: false
56
54
  requirement: !ruby/object:Gem::Requirement
55
+ none: false
57
56
  requirements:
58
57
  - - ! '>='
59
58
  - !ruby/object:Gem::Version
60
59
  version: '0'
61
- none: false
60
+ type: :runtime
61
+ prerelease: false
62
62
  - !ruby/object:Gem::Dependency
63
+ name: chronic
63
64
  version_requirements: !ruby/object:Gem::Requirement
65
+ none: false
64
66
  requirements:
65
67
  - - ! '>='
66
68
  - !ruby/object:Gem::Version
67
69
  version: '0'
68
- none: false
69
- name: chronic
70
- type: :runtime
71
- prerelease: false
72
70
  requirement: !ruby/object:Gem::Requirement
71
+ none: false
73
72
  requirements:
74
73
  - - ! '>='
75
74
  - !ruby/object:Gem::Version
76
75
  version: '0'
77
- none: false
76
+ type: :runtime
77
+ prerelease: false
78
78
  - !ruby/object:Gem::Dependency
79
+ name: mocha
79
80
  version_requirements: !ruby/object:Gem::Requirement
81
+ none: false
80
82
  requirements:
81
83
  - - ! '>='
82
84
  - !ruby/object:Gem::Version
83
85
  version: '0'
84
- none: false
85
- name: mocha
86
- type: :development
87
- prerelease: false
88
86
  requirement: !ruby/object:Gem::Requirement
87
+ none: false
89
88
  requirements:
90
89
  - - ! '>='
91
90
  - !ruby/object:Gem::Version
92
91
  version: '0'
93
- none: false
92
+ type: :development
93
+ prerelease: false
94
94
  - !ruby/object:Gem::Dependency
95
+ name: sqlite3-ruby
95
96
  version_requirements: !ruby/object:Gem::Requirement
97
+ none: false
96
98
  requirements:
97
99
  - - ! '>='
98
100
  - !ruby/object:Gem::Version
99
101
  version: '0'
100
- none: false
101
- name: sqlite3-ruby
102
- type: :development
103
- prerelease: false
104
102
  requirement: !ruby/object:Gem::Requirement
103
+ none: false
105
104
  requirements:
106
105
  - - ! '>='
107
106
  - !ruby/object:Gem::Version
108
107
  version: '0'
109
- none: false
108
+ type: :development
109
+ prerelease: false
110
110
  description: Rendering spreadsheets from Rails made easy
111
111
  email: glex.spb@gmail.com
112
112
  executables: []
@@ -147,20 +147,20 @@ rdoc_options: []
147
147
  require_paths:
148
148
  - lib
149
149
  required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
150
151
  requirements:
151
152
  - - ! '>='
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
154
- none: false
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
156
157
  requirements:
157
158
  - - ! '>='
158
159
  - !ruby/object:Gem::Version
159
160
  version: '0'
160
- none: false
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 1.8.24
163
+ rubygems_version: 1.8.25
164
164
  signing_key:
165
165
  specification_version: 3
166
166
  summary: Render existing views as Excel documents with style!