spreadsheet_architect 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +14 -6
- data/lib/spreadsheet_architect/class_methods/xlsx.rb +1 -1
- data/lib/spreadsheet_architect/utils/xlsx.rb +4 -4
- data/lib/spreadsheet_architect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df0aa255d5445fd262b8f2244cf4ea0e4ab7558c
|
4
|
+
data.tar.gz: 3c18faecb6e3453fa2f2fda45653ce500dcdc2d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9687a9b89f283b77b643ce786fa3ebeb831fe995a4caa091b254a1c78776dfd796ec8b91d9889ff94b0f584c055994784d776c732948867f146ee259f3617c15
|
7
|
+
data.tar.gz: 6c97b06aed2bb6ffb0de766bbce50f8bef0f5bf01b3dce862380be1f7ee24c5f50500aab198157df10a9f612697698bd3ed04d4910c05910e693859cdd0ed41e
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
---------
|
3
3
|
|
4
|
+
- **July.14.2017**: 2.0.2
|
5
|
+
- Fix bug with range styles rows option not counting headers
|
6
|
+
- Fix bug with range styles rows :all option
|
4
7
|
- **February.16.2017**: 2.0.1
|
5
8
|
- Fix bug where `SpreadsheetArchitect.default_options` and `SPREADSHEET_OPTIONS` were being overwritten
|
6
9
|
- Fix bug where col_styles ignored previous styles on header when using `include_header` option
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# Spreadsheet Architect
|
2
|
-
<a href='https://www.patreon.com/bePatron?u=4956947' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://miraclesfor.me/wp-content/plugins/patron-button-and-widgets-by-codebard/images/patreon-medium-button.png' border='0' alt='Become a Patron' /></a>
|
3
2
|
<a href='https://ko-fi.com/A5071NK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
|
4
3
|
|
5
4
|
Spreadsheet Architect is a library that allows you to create XLSX, ODS, or CSV spreadsheets easily from ActiveRecord relations, Plain Ruby classes, or predefined data.
|
@@ -177,7 +176,9 @@ end
|
|
177
176
|
|**column_widths**<br>*Array*||Sometimes you may want explicit column widths. Use nil if you want a column to autofit again.|
|
178
177
|
|
179
178
|
<br>
|
179
|
+
|
180
180
|
## SomeClass.to_ods
|
181
|
+
|
181
182
|
|Option|Default|Notes|
|
182
183
|
|---|---|---|
|
183
184
|
|**spreadsheet_columns**<br>*Array*| This defaults to your models custom `spreadsheet_columns` method or any custom defaults defined.<br>If none of those then falls back to `self.column_names` for ActiveRecord models. | Use this option to override the model instances `spreadsheet_columns` method|
|
@@ -188,7 +189,9 @@ end
|
|
188
189
|
|**row_style**<br>*Hash*|`{background_color: nil, color: "000000", align: :left, font_size: 10, bold: false}`|Styles for non-header rows. Currently ODS only supports these options|
|
189
190
|
|
190
191
|
<br>
|
192
|
+
|
191
193
|
## SomeClass.to_csv
|
194
|
+
|
192
195
|
|Option|Default|Notes|
|
193
196
|
|---|---|---|
|
194
197
|
|**spreadsheet_columns**<br>*Array*| This defaults to your models custom `spreadsheet_columns` method or any custom defaults defined.<br>If none of those then falls back to `self.column_names` for ActiveRecord models. | Use this to option override the model instances `spreadsheet_columns` method|
|
@@ -196,7 +199,9 @@ end
|
|
196
199
|
|**headers**<br>*2D Array*|`self.column_names.collect(&:titleize)`| Data for the header rows cells. Pass `false` to skip the header row.|
|
197
200
|
|
198
201
|
<br>
|
202
|
+
|
199
203
|
## SpreadsheetArchitect.to_xlsx
|
204
|
+
|
200
205
|
|Option|Default|Notes|
|
201
206
|
|---|---|---|
|
202
207
|
|**data**<br>*Array*| |Data for the non-header row cells. |
|
@@ -212,7 +217,9 @@ end
|
|
212
217
|
|**column_widths**<br>*Array*||Sometimes you may want explicit column widths. Use nil if you want a column to autofit again.|
|
213
218
|
|
214
219
|
<br>
|
220
|
+
|
215
221
|
## SpreadsheetArchitect.to_ods
|
222
|
+
|
216
223
|
|Option|Default|Notes|
|
217
224
|
|---|---|---|
|
218
225
|
|**data**<br>*2D Array*| |Data for the non-header row cells.|
|
@@ -223,7 +230,9 @@ end
|
|
223
230
|
|**column_types**<br>*Array*||Valid types for ODS are :string, :float, :date, :percent, :currency, nil = auto determine|
|
224
231
|
|
225
232
|
<br>
|
233
|
+
|
226
234
|
## SpreadsheetArchitect.to_csv
|
235
|
+
|
227
236
|
|Option|Default|Notes|
|
228
237
|
|---|---|---|
|
229
238
|
|**data**<br>*2D Array*| |Data for the non-header row cells.|
|
@@ -291,13 +300,12 @@ See this example: (https://github.com/westonganger/spreadsheet_architect/blob/ma
|
|
291
300
|
|
292
301
|
|
293
302
|
# Axlsx Style Reference
|
294
|
-
I have compiled a list of all available style options for `axlsx` here: (https://github.com/westonganger/spreadsheet_architect/blob/master/docs/
|
303
|
+
I have compiled a list of all available style options for `axlsx` here: (https://github.com/westonganger/spreadsheet_architect/blob/master/docs/axlsx_style_reference.md)
|
295
304
|
|
296
305
|
|
297
306
|
# Credits
|
298
|
-
Created by
|
307
|
+
Created by [@westonganger](https://github.com/westonganger)
|
299
308
|
|
300
|
-
|
309
|
+
For any consulting or contract work please contact me via my company website: [Solid Foundation Web Development](https://solidfoundationwebdev.com)
|
301
310
|
|
302
|
-
|
303
|
-
<a href='https://ko-fi.com/A5071NK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
|
311
|
+
[](https://solidfoundationwebdev.com)
|
@@ -96,7 +96,7 @@ module SpreadsheetArchitect
|
|
96
96
|
|
97
97
|
if options[:borders] || options[:column_styles] || options[:range_styles] || options[:merges]
|
98
98
|
col_names = max_row_length > 675 ? Array('A'..'ZZZ') : Array('A'..'ZZ')
|
99
|
-
num_rows = options[:data].count
|
99
|
+
num_rows = options[:data].count + (options[:headers] ? options[:headers].count : 0)
|
100
100
|
end
|
101
101
|
|
102
102
|
if options[:borders]
|
@@ -59,7 +59,7 @@ module SpreadsheetArchitect
|
|
59
59
|
when Range
|
60
60
|
start_col = col_names[hash[:columns].first]
|
61
61
|
end_col = col_names[hash[:columns].last]
|
62
|
-
when
|
62
|
+
when :all
|
63
63
|
start_col = 'A'
|
64
64
|
end_col = col_names[num_columns-1]
|
65
65
|
else
|
@@ -72,9 +72,9 @@ module SpreadsheetArchitect
|
|
72
72
|
when Range
|
73
73
|
start_row = hash[:rows].first
|
74
74
|
end_row = hash[:rows].last
|
75
|
-
when
|
76
|
-
start_row =
|
77
|
-
end_row = num_rows
|
75
|
+
when :all
|
76
|
+
start_row = 1
|
77
|
+
end_row = num_rows
|
78
78
|
else
|
79
79
|
raise SpreadsheetArchitect::Exceptions::InvalidRangeStylesOptionError.new(:rows, hash)
|
80
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet_architect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: axlsx
|